1: #include "parms.h"
2: #include "structs.h"
3: #include <pwd.h>
4:
5: #ifdef RCSIDENT
6: static char rcsid[] = "$Header: gname.c,v 1.7.0.1 85/03/17 20:55:37 notes Rel $";
7: #endif RCSIDENT
8:
9:
10: /*
11: * get the user id ( and his name from th password file )
12: * the easy way - with system calls.
13: */
14: getname (who_me, anon) /* anon=true for anonymous */
15: struct auth_f *who_me;
16: {
17: register count;
18: register char *s,
19: *d;
20: static int gotname = 0; /* whether we have done a getpw */
21: static struct passwd *gotstat = 0;
22:
23: if (gotname == 0 && anon == 0) /* grab name if we will require it */
24: {
25: gotstat = getpwuid(globuid); /* grab it */
26: gotname = 1; /* set flag saying we have it */
27: }
28: if (!gotstat || anon)
29: {
30: s = "Anonymous:";
31: who_me -> aid = Anonuid;
32: }
33: else
34: {
35: s = gotstat->pw_name;
36: who_me -> aid = globuid;
37: }
38: d = who_me -> aname; /* copy his name */
39: count = NAMESZ;
40: while (((*d++ = *s++) != '\0') && --count);
41: *--d = '\0';
42: s = Authsystem; /* copy his system */
43: d = who_me -> asystem;
44: count = HOMESYSSZ;
45: while (((*d++ = *s++)) != '\0' && --count); /* move system */
46: *--d = '\0';
47: }
Defined functions
Defined variables
rcsid
defined in line
6;
never used