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

Diff for /src/usr.bin/rcs/co.c between version 1.123 and 1.124

version 1.123, 2017/08/29 16:47:33 version 1.124, 2019/01/09 18:00:45
Line 358 
Line 358 
         }          }
   
         /*          /*
          * Do keyword expansion if required.  
          */  
         if (file->rf_ndelta != 0)  
                 bp = rcs_kwexp_buf(bp, file, rev);  
         /*  
          * File inherits permissions from its ,v file           * File inherits permissions from its ,v file
          */           */
         if (file->rf_file != NULL) {          if (file->rf_file != NULL) {
Line 374 
Line 369 
         }          }
   
         if (flags & CO_LOCK) {          if (flags & CO_LOCK) {
                 if (file->rf_ndelta != 0) {  
                         if (lockname != NULL &&  
                             rcs_lock_add(file, lockname, rev) < 0) {  
                                 if (rcs_errno != RCS_ERR_DUPENT)  
                                         return (-1);  
                         }  
                 }  
   
                 /* File should only be writable by owner. */                  /* File should only be writable by owner. */
                 mode &= ~(S_IWGRP|S_IWOTH);                  mode &= ~(S_IWGRP|S_IWOTH);
                 mode |= S_IWUSR;                  mode |= S_IWUSR;
Line 389 
Line 376 
                 if (file->rf_ndelta != 0) {                  if (file->rf_ndelta != 0) {
                         if (!(flags & QUIET) && !(flags & NEWFILE) &&                          if (!(flags & QUIET) && !(flags & NEWFILE) &&
                             !(flags & CO_REVERT))                              !(flags & CO_REVERT))
                                 (void)fprintf(stderr, " (locked)");                                  (void)fprintf(stderr, " (locked)\n");
                 }                  }
         } else if (flags & CO_UNLOCK) {          } else if (flags & CO_UNLOCK) {
                 if (file->rf_ndelta != 0) {                  if (file->rf_ndelta != 0) {
Line 405 
Line 392 
                 if (file->rf_ndelta != 0) {                  if (file->rf_ndelta != 0) {
                         if (!(flags & QUIET) && !(flags & NEWFILE) &&                          if (!(flags & QUIET) && !(flags & NEWFILE) &&
                             !(flags & CO_REVERT))                              !(flags & CO_REVERT))
                                 (void)fprintf(stderr, " (unlocked)");                                  (void)fprintf(stderr, " (unlocked)\n");
                 }                  }
         }          }
   
         /* If strict locking is disabled, make file writable by owner. */  
         if (rcs_lock_getmode(file) == RCS_LOCK_LOOSE)  
                 mode |= S_IWUSR;  
   
         if (file->rf_ndelta == 0 && !(flags & QUIET) &&  
             ((flags & CO_LOCK) || (flags & CO_UNLOCK))) {  
                 (void)fprintf(stderr, "no revisions, so nothing can be %s\n",  
                     (flags & CO_LOCK) ? "locked" : "unlocked");  
         } else if (file->rf_ndelta != 0) {  
                 /* XXX - Not a good way to detect if a newline is needed. */  
                 if (!(flags & QUIET) && !(flags & NEWFILE) &&  
                     !(flags & CO_REVERT))  
                         (void)fprintf(stderr, "\n");  
         }  
   
         if (flags & CO_LOCK) {  
                 if (rcs_errno != RCS_ERR_DUPENT)  
                         lcount++;  
                 if (!(flags & QUIET) && lcount > 1 && !(flags & CO_REVERT))  
                         warnx("%s: warning: You now have %d locks.",  
                             file->rf_path, lcount);  
         }  
   
         if ((flags & (PIPEOUT|FORCE)) == 0 && stat(dst, &st) != -1) {          if ((flags & (PIPEOUT|FORCE)) == 0 && stat(dst, &st) != -1) {
                 /*                  /*
                  * Prompt the user if the file is writable or the file is                   * Prompt the user if the file is writable or the file is
Line 461 
Line 425 
                         }                          }
                 }                  }
         }          }
   
           if (flags & CO_LOCK) {
                   if (file->rf_ndelta != 0) {
                           if (lockname != NULL &&
                               rcs_lock_add(file, lockname, rev) < 0) {
                                   if (rcs_errno != RCS_ERR_DUPENT)
                                           return (-1);
                           }
                   }
           }
   
           /* If strict locking is disabled, make file writable by owner. */
           if (rcs_lock_getmode(file) == RCS_LOCK_LOOSE)
                   mode |= S_IWUSR;
   
           if (file->rf_ndelta == 0 && !(flags & QUIET) &&
               ((flags & CO_LOCK) || (flags & CO_UNLOCK))) {
                   (void)fprintf(stderr, "no revisions, so nothing can be %s\n",
                       (flags & CO_LOCK) ? "locked" : "unlocked");
           } else if (file->rf_ndelta != 0) {
                   /* XXX - Not a good way to detect if a newline is needed. */
                   if (!(flags & QUIET) && !(flags & NEWFILE) &&
                       !(flags & CO_REVERT))
                           (void)fprintf(stderr, "\n");
           }
   
           if (flags & CO_LOCK) {
                   if (rcs_errno != RCS_ERR_DUPENT)
                           lcount++;
                   if (!(flags & QUIET) && lcount > 1 && !(flags & CO_REVERT))
                           warnx("%s: warning: You now have %d locks.",
                               file->rf_path, lcount);
           }
   
           /* Finally do keyword expansion if required. */
           if (file->rf_ndelta != 0)
                   bp = rcs_kwexp_buf(bp, file, rev);
   
         if (flags & PIPEOUT)          if (flags & PIPEOUT)
                 buf_write_fd(bp, STDOUT_FILENO);                  buf_write_fd(bp, STDOUT_FILENO);

Legend:
Removed from v.1.123  
changed lines
  Added in v.1.124