jfh@rpp386.Dallas.TX.US (John F. Haugh II) (07/08/89)
In article <14448@bfmny0.UUCP> tneff@bfmny0.UUCP (Tom Neff) writes: >If you need a FAST way to generate the name of your current effective >user (including the effects of su(1) etc), this works. It's not fancy. >Obviously it has to read /etc/passwd. Feel free to hack and pass >around. >X while (fgets(line, sizeof(line), pass) != NULL) This is not a very good idea. You make assumptions about the password file which probably won't be holding true for too many more releases of UNIX. getpwuid() is going to be your best bet. It should be hoped that your local software vendor took the time to implement getpwuid() in an efficient manner; such as using YP or ndbm or whatever services are available. In a distributed environment the password file may not even reside on your machine completely. -- John F. Haugh II +-Quote of the month club: ------------ VoiceNet: (512) 832-8832 Data: -8835 | "Computer security is to information InterNet: jfh@rpp386.cactus.org | control as a chastity belt is to UucpNet : <backbone>!bigtex!rpp386!jfh +- birth control" -- Doug Steves --
wht@tridom.uucp (Warren Tucker) (07/10/89)
In article <37612@sgi.SGI.COM>, jmb@patton.sgi.com (Jim Barton) writes: > > Why waste time with this? The system V 'id' command does the > same thing! And, it's standard! > whoami is standard on BSD, too, and prints exactly what the other gentleman and I wanted to know without all that sed gibberish. But why am I responding to someone who wastes 1000s of alt.sources readers time with his opinion of waste :-) ? Jeez people: 1) while(1) { puts("post only sources to alt.sources); } 2) be a little tolerant > "I used to be disgusted, now I'm just amused." > -- :-) -- ------------------------------------------------------------------- Warren Tucker, Tridom Corporation ...!gatech!emory!tridom!wht Sforzando (It., sfohr-tsahn'-doh). A direction to perform the tone or chord with special stress, or marked and sudden emphasis.