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

Diff for /src/usr.bin/rcs/rcs.c between version 1.56 and 1.57

version 1.56, 2010/07/13 20:07:24 version 1.57, 2010/07/21 09:22:19
Line 1344 
Line 1344 
  * one).  The <msg> argument specifies the log message for that revision, and   * one).  The <msg> argument specifies the log message for that revision, and
  * <date> specifies the revision's date (a value of -1 is   * <date> specifies the revision's date (a value of -1 is
  * equivalent to using the current time).   * equivalent to using the current time).
  * If <username> is NULL, set the author for this revision to the current user.   * If <author> is NULL, set the author for this revision to the current user.
  * Otherwise, set it to <username>.  
  * Returns 0 on success, or -1 on failure.   * Returns 0 on success, or -1 on failure.
  */   */
 int  int
 rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date,  rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date,
     const char *username)      const char *author)
 {  {
         time_t now;          time_t now;
         struct passwd *pw;          struct passwd *pw;
         struct rcs_delta *ordp, *rdp;          struct rcs_delta *ordp, *rdp;
         uid_t uid;  
   
         if (rev == RCS_HEAD_REV) {          if (rev == RCS_HEAD_REV) {
                 if (rf->rf_flags & RCS_CREATE) {                  if (rf->rf_flags & RCS_CREATE) {
Line 1373 
Line 1371 
                 }                  }
         }          }
   
         uid = getuid();  
         if ((pw = getpwuid(uid)) == NULL)  
                 errx(1, "getpwuid failed");  
   
         rdp = xcalloc(1, sizeof(*rdp));          rdp = xcalloc(1, sizeof(*rdp));
   
         TAILQ_INIT(&(rdp->rd_branches));          TAILQ_INIT(&(rdp->rd_branches));
Line 1392 
Line 1386 
                 rcsnum_cpy(ordp->rd_num, rdp->rd_next, 0);                  rcsnum_cpy(ordp->rd_num, rdp->rd_next, 0);
         }          }
   
         if (uid == 0)          if (!author && !(author = getlogin())) {
                 username = getlogin();                  if (!(pw = getpwuid(getuid())))
         if (username == NULL || *username == '\0')                          errx(1, "getpwuid failed");
                 username = pw->pw_name;                  author = pw->pw_name;
           }
         rdp->rd_author = xstrdup(username);          rdp->rd_author = xstrdup(author);
         rdp->rd_state = xstrdup(RCS_STATE_EXP);          rdp->rd_state = xstrdup(RCS_STATE_EXP);
         rdp->rd_log = xstrdup(msg);          rdp->rd_log = xstrdup(msg);
   

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57