[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.12 and 1.13

version 1.12, 1998/06/12 17:51:50 version 1.13, 2001/11/21 15:26:39
Line 36 
Line 36 
   
 #ifndef lint  #ifndef lint
 #if 0  #if 0
 static char sccsid[] = "@(#)v7.local.c  8.1 (Berkeley) 6/6/93";  static const char sccsid[] = "@(#)v7.local.c    8.1 (Berkeley) 6/6/93";
 #else  #else
 static char rcsid[] = "$OpenBSD$";  static const char rcsid[] = "$OpenBSD$";
 #endif  #endif
 #endif /* not lint */  #endif /* not lint */
   
Line 60 
Line 60 
  * mail is queued).   * mail is queued).
  */   */
 void  void
 findmail(user, buf, buflen)  findmail(char *user, char *buf, int buflen)
         char *user, *buf;  
         int buflen;  
 {  {
         char *mbox;          char *mbox;
         struct stat sb;          struct stat sb;
Line 72 
Line 70 
             sb.st_uid != getuid() && sb.st_uid != geteuid())              sb.st_uid != getuid() && sb.st_uid != geteuid())
                 mbox = NULL;                  mbox = NULL;
   
         if (mbox) {          if (mbox)
                 (void)strncpy(buf, mbox, buflen - 1);                  (void)strlcpy(buf, mbox, buflen);
                 buf[buflen - 1] = '\0';          else
         } else  
                 (void)snprintf(buf, buflen, "%s/%s", _PATH_MAILDIR, user);                  (void)snprintf(buf, buflen, "%s/%s", _PATH_MAILDIR, user);
 }  }
   
Line 83 
Line 80 
  * Get rid of the queued mail.   * Get rid of the queued mail.
  */   */
 void  void
 demail()  demail(void)
 {  {
   
         if (value("keep") != NULL || rm(mailname) < 0)          if (value("keep") != NULL || rm(mailname) < 0)
Line 94 
Line 91 
  * Discover user login name.   * Discover user login name.
  */   */
 char *  char *
 username()  username(void)
 {  {
         char *np;          char *np;
         uid_t uid;          uid_t uid;
Line 104 
Line 101 
         if ((np = getenv("LOGNAME")) != NULL)          if ((np = getenv("LOGNAME")) != NULL)
                 return(np);                  return(np);
         if ((np = getname(uid = getuid())) != NULL)          if ((np = getname(uid = getuid())) != NULL)
                   return(np);
           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", (unsigned)uid);
         return(NULL);          return(NULL);

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13