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

Diff for /src/usr.bin/diff/diff.c between version 1.61 and 1.62

version 1.61, 2015/10/05 15:42:54 version 1.62, 2015/10/05 20:15:00
Line 26 
Line 26 
 #include <err.h>  #include <err.h>
 #include <errno.h>  #include <errno.h>
 #include <getopt.h>  #include <getopt.h>
 #include <signal.h>  
 #include <stdlib.h>  #include <stdlib.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdarg.h>  #include <stdarg.h>
Line 37 
Line 36 
 #include "diff.h"  #include "diff.h"
 #include "xmalloc.h"  #include "xmalloc.h"
   
 int      lflag, Nflag, Pflag, rflag, sflag, Tflag;  int      Nflag, Pflag, rflag, sflag, Tflag;
 int      diff_format, diff_context, status;  int      diff_format, diff_context, status;
 char    *start, *ifdefname, *diffargs, *label[2], *ignore_pats;  char    *start, *ifdefname, *diffargs, *label[2], *ignore_pats;
 struct stat stb1, stb2;  struct stat stb1, stb2;
Line 55 
Line 54 
         { "forward-ed",                 no_argument,            0,      'f' },          { "forward-ed",                 no_argument,            0,      'f' },
         { "ignore-matching-lines",      required_argument,      0,      'I' },          { "ignore-matching-lines",      required_argument,      0,      'I' },
         { "ignore-case",                no_argument,            0,      'i' },          { "ignore-case",                no_argument,            0,      'i' },
         { "paginate",                   no_argument,            0,      'l' },  
         { "label",                      required_argument,      0,      'L' },          { "label",                      required_argument,      0,      'L' },
         { "new-file",                   no_argument,            0,      'N' },          { "new-file",                   no_argument,            0,      'N' },
         { "rcs",                        no_argument,            0,      'n' },          { "rcs",                        no_argument,            0,      'n' },
Line 152 
Line 150 
                         else                          else
                                 usage();                                  usage();
                         break;                          break;
                 case 'l':  
                         lflag = 1;  
                         signal(SIGPIPE, SIG_IGN);  
                         break;  
                 case 'N':                  case 'N':
                         Nflag = 1;                          Nflag = 1;
                         break;                          break;
Line 217 
Line 211 
         argc -= optind;          argc -= optind;
         argv += optind;          argv += optind;
   
         if (lflag == 0) {          if (getenv("TMPDIR")) {
                 if (getenv("TMPDIR")) {                  if (tame("stdio rpath wpath cpath", NULL) == -1)
                         if (tame("stdio rpath wpath cpath", NULL) == -1)                          err(1, "tame");
                                 err(1, "tame");          } else {
                 } else {                  if (tame("stdio rpath tmppath", NULL) == -1)
                         if (tame("stdio rpath tmppath", NULL) == -1)                          err(1, "tame");
                                 err(1, "tame");  
                 }  
         }          }
   
         /*          /*
          * Do sanity checks, fill in stb1 and stb2 and call the appropriate           * Do sanity checks, fill in stb1 and stb2 and call the appropriate
          * driver routine.  Both drivers use the contents of stb1 and stb2.           * driver routine.  Both drivers use the contents of stb1 and stb2.
Line 364 
Line 357 
 print_status(int val, char *path1, char *path2, char *entry)  print_status(int val, char *path1, char *path2, char *entry)
 {  {
         switch (val) {          switch (val) {
         case D_ONLY:  
                 print_only(path1, strlen(path1), entry);  
                 break;  
         case D_COMMON:  
                 printf("Common subdirectories: %s%s and %s%s\n",  
                     path1, entry, path2, entry);  
                 break;  
         case D_BINARY:          case D_BINARY:
                 printf("Binary files %s%s and %s%s differ\n",                  printf("Binary files %s%s and %s%s differ\n",
                     path1, entry, path2, entry);                      path1, entry, path2, entry);
Line 408 
Line 394 
 usage(void)  usage(void)
 {  {
         (void)fprintf(stderr,          (void)fprintf(stderr,
             "usage: diff [-abdilpTtw] [-c | -e | -f | -n | -q | -u] [-I pattern] [-L label]\n"              "usage: diff [-abdipTtw] [-c | -e | -f | -n | -q | -u] [-I pattern] [-L label]\n"
             "            file1 file2\n"              "            file1 file2\n"
             "       diff [-abdilpTtw] [-I pattern] [-L label] -C number file1 file2\n"              "       diff [-abdipTtw] [-I pattern] [-L label] -C number file1 file2\n"
             "       diff [-abdiltw] [-I pattern] -D string file1 file2\n"              "       diff [-abditw] [-I pattern] -D string file1 file2\n"
             "       diff [-abdilpTtw] [-I pattern] [-L label] -U number file1 file2\n"              "       diff [-abdipTtw] [-I pattern] [-L label] -U number file1 file2\n"
             "       diff [-abdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [-I pattern]\n"              "       diff [-abdiNPprsTtw] [-c | -e | -f | -n | -q | -u] [-I pattern]\n"
             "            [-L label] [-S name] [-X file] [-x pattern] dir1 dir2\n");              "            [-L label] [-S name] [-X file] [-x pattern] dir1 dir2\n");
   
         exit(2);          exit(2);

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.62