[BACK]Return to v7.local.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mail

Diff for /src/usr.bin/mail/v7.local.c between version 1.17 and 1.18

version 1.17, 2016/07/19 06:43:27 version 1.18, 2018/09/16 02:38:57
Line 41 
Line 41 
 #include "rcv.h"  #include "rcv.h"
 #include <stdlib.h>  #include <stdlib.h>
 #include <fcntl.h>  #include <fcntl.h>
   #include <pwd.h>
 #include "extern.h"  #include "extern.h"
   
 /*  /*
Line 48 
Line 49 
  * mail is queued).   * mail is queued).
  */   */
 void  void
 findmail(char *user, char *buf, int buflen)  findmail(const char *user, char *buf, int buflen)
 {  {
         char *mbox;          char *mbox;
         struct stat sb;          struct stat sb;
Line 82 
Line 83 
 /*  /*
  * Discover user login name.   * Discover user login name.
  */   */
 char *  const char *
 username(void)  username(void)
 {  {
         char *np;          const char *np;
         uid_t uid;          uid_t uid;
   
         if ((np = getenv("USER")) != NULL)          if ((np = getenv("USER")) != NULL)
                 return(np);                  return(np);
         if ((np = getenv("LOGNAME")) != NULL)          if ((np = getenv("LOGNAME")) != NULL)
                 return(np);                  return(np);
         if ((np = getname(uid = getuid())) != NULL)          if ((np = user_from_uid(uid = getuid(), 1)) != NULL)
                 return(np);                  return(np);
         if ((np = getlogin()) != NULL)          if ((np = getlogin()) != NULL)
                 return(np);                  return(np);
         printf("Cannot associate a name with uid %u\n", (unsigned)uid);          printf("Cannot associate a name with uid %u\n", uid);
         return(NULL);          return(NULL);
 }  }

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18