1: #include "parms.h"
2: #include "structs.h"
3:
4: #ifdef RCSIDENT
5: static char rcsid[] = "$Header: gname.c,v 1.7.0.1 85/03/17 20:55:37 notes Rel $";
6: #endif RCSIDENT
7:
8:
9: /*
10: * get the user id ( and his name from th password file )
11: * the easy way - with system calls.
12: */
13: getname (who_me, anon) /* anon=true for anonymous */
14: struct auth_f *who_me;
15: {
16: static char name[PASSWDLEN]; /* must contain the /etc/passwd entry */
17: register count;
18: register char *s,
19: *d;
20: static int gotname = 0; /* whether we have done a getpw */
21: static int gotstat = 0; /* status getpw returned */
22:
23: if (gotname == 0 && anon == 0) /* grab name if we will require it */
24: {
25: gotstat = getpw (globuid, name); /* 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 = name;
36: who_me -> aid = globuid;
37: }
38: d = who_me -> aname; /* copy his name */
39: count = NAMESZ;
40: while (((*d++ = *s++) != ':') && --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
5;
never used