# 2.11BSD#431 - /usr/src/new/notes/src/gname.c

##### Functions

    getname           X

       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

getname defined in line 14; used 10 times

- in /usr/src/new/notes/src/access.c line 235
- in /usr/src/new/notes/src/adnote.c line 104
- in /usr/src/new/notes/src/adresp.c line 69
- in /usr/src/new/notes/src/buildnf.c line 223
- in /usr/src/new/notes/src/checknotes.c line 145
- in /usr/src/new/notes/src/dropt.c line 458
- in /usr/src/new/notes/src/main.c line 127
- in /usr/src/new/notes/src/nfpipe.c line 108
- in /usr/src/new/notes/src/recsio.c line 46
- in /usr/src/new/notes/src/startup.c line 125

#### Defined variables

rcsid defined in line 6; never used

Last modified: 1996-03-22 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 542 |