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

Diff for /src/usr.bin/patch/patch.c between version 1.10 and 1.11

version 1.10, 1997/09/22 05:45:27 version 1.11, 1998/11/25 00:30:26
Line 6 
Line 6 
  *   *
  * This program may be copied as long as you don't try to make any   * This program may be copied as long as you don't try to make any
  * money off of it, or pretend that you wrote it.   * money off of it, or pretend that you wrote it.
    *
    * -C option added in 1998, original code by Marc Espie,
    * based on FreeBSD behaviour
  */   */
   
 #ifndef lint  #ifndef lint
Line 48 
Line 51 
 /* TRUE if -R was specified on command line.  */  /* TRUE if -R was specified on command line.  */
 static int reverse_flag_specified = FALSE;  static int reverse_flag_specified = FALSE;
   
   /* TRUE if -C was specified on command line.  */
   bool check_only = FALSE;
   
 /* Apply a set of diffs as appropriate. */  /* Apply a set of diffs as appropriate. */
   
 int  int
Line 282 
Line 288 
             struct stat statbuf;              struct stat statbuf;
             char *realout = outname;              char *realout = outname;
   
             if (move_file(TMPOUTNAME, outname) < 0) {              if (!check_only) {
                 toutkeep = TRUE;                  if (move_file(TMPOUTNAME, outname) < 0) {
                 realout = TMPOUTNAME;                      toutkeep = TRUE;
                 chmod(TMPOUTNAME, filemode);                      realout = TMPOUTNAME;
             }                      chmod(TMPOUTNAME, filemode);
             else                  }
                 chmod(outname, filemode);                  else
                       chmod(outname, filemode);
   
             if (remove_empty_files && stat(realout, &statbuf) == 0                  if (remove_empty_files && stat(realout, &statbuf) == 0
                 && statbuf.st_size == 0) {                      && statbuf.st_size == 0) {
                 if (verbose)                      if (verbose)
                     say2("Removing %s (empty after patching).\n", realout);                          say2("Removing %s (empty after patching).\n", realout);
                 while (unlink(realout) >= 0) ; /* while is for Eunice.  */                      while (unlink(realout) >= 0) ; /* while is for Eunice.  */
                   }
             }              }
         }          }
         Fclose(rejfp);          Fclose(rejfp);
Line 325 
Line 333 
                 say4("%d out of %d hunks failed--saving rejects to %s\n",                  say4("%d out of %d hunks failed--saving rejects to %s\n",
                     failed, hunk, rejname);                      failed, hunk, rejname);
             }              }
             if (move_file(TMPREJNAME, rejname) < 0)              if (!check_only && move_file(TMPREJNAME, rejname) < 0)
                 trejkeep = TRUE;                  trejkeep = TRUE;
         }          }
         set_signals(1);          set_signals(1);
Line 481 
Line 489 
             case 'c':              case 'c':
                 diff_type = CONTEXT_DIFF;                  diff_type = CONTEXT_DIFF;
                 break;                  break;
               case 'C':
                   check_only = TRUE;
                   break;
             case 'd':              case 'd':
                 if (!*++s)                  if (!*++s)
                     s = nextarg();                      s = nextarg();
Line 571 
Line 582 
                 fprintf(stderr, "\                  fprintf(stderr, "\
 Usage: patch [options] [origfile [patchfile]] [+ [options] [origfile]]...\n\  Usage: patch [options] [origfile [patchfile]] [+ [options] [origfile]]...\n\
 Options:\n\  Options:\n\
        [-ceEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n\         [-cCeEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n\
        [-D symbol] [-Fmax-fuzz] [-o out-file] [-p[strip-count]]\n\         [-D symbol] [-Fmax-fuzz] [-o out-file] [-p[strip-count]]\n\
        [-r rej-name] [-V {numbered,existing,simple}]\n");         [-r rej-name] [-V {numbered,existing,simple}]\n");
                 my_exit(1);                  my_exit(1);

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11