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

Diff for /src/usr.bin/cvs/diff_internals.c between version 1.16 and 1.17

version 1.16, 2008/01/31 20:11:28 version 1.17, 2008/02/03 18:18:44
Line 179 
Line 179 
 static void      equiv(struct line *, int, struct line *, int, int *);  static void      equiv(struct line *, int, struct line *, int, int *);
 static void      unravel(int);  static void      unravel(int);
 static void      unsort(struct line *, int, int *);  static void      unsort(struct line *, int, int *);
   static void      diff_head(void);
   static void      rdiff_head(void);
 static void      change(FILE *, FILE *, int, int, int, int);  static void      change(FILE *, FILE *, int, int, int, int);
 static void      sort(struct line *, int);  static void      sort(struct line *, int);
 static int       ignoreline(char *);  static int       ignoreline(char *);
Line 194 
Line 196 
 static char     *match_function(const long *, int, FILE *);  static char     *match_function(const long *, int, FILE *);
 static char     *preadline(int, size_t, off_t);  static char     *preadline(int, size_t, off_t);
   
 static int aflag, bflag, dflag, iflag, tflag, Tflag, wflag;  static int aflag, bflag, dflag, tflag, Tflag, wflag;
 static int context = 3;  static int context = 3;
 int diff_format = D_NORMAL;  int diff_format = D_NORMAL;
   int diff_iflag = 0;
 int diff_pflag = 0;  int diff_pflag = 0;
 char *diff_file = NULL;  char *diff_file = NULL;
 RCSNUM *diff_rev1 = NULL;  RCSNUM *diff_rev1 = NULL;
Line 303 
Line 306 
         lastline = 0;          lastline = 0;
         lastmatchline = 0;          lastmatchline = 0;
         context_vec_ptr = context_vec_start - 1;          context_vec_ptr = context_vec_start - 1;
         chrtran = (iflag ? cup2low : clow2low);          chrtran = (diff_iflag ? cup2low : clow2low);
         if (out != NULL)          if (out != NULL)
                 diffbuf = out;                  diffbuf = out;
   
Line 634 
Line 637 
                         ixnew[j] = ctnew += skipline(f2);                          ixnew[j] = ctnew += skipline(f2);
                         j++;                          j++;
                 }                  }
                 if (bflag == 1 || wflag == 1 || iflag == 1) {                  if (bflag == 1 || wflag == 1 || diff_iflag == 1) {
                         for (;;) {                          for (;;) {
                                 c = getc(f1);                                  c = getc(f1);
                                 d = getc(f2);                                  d = getc(f2);
Line 852 
Line 855 
         return (ret == 0);      /* if it matched, it should be ignored. */          return (ret == 0);      /* if it matched, it should be ignored. */
 }  }
   
   static void
   diff_head(void)
   {
           char buf[64];
           struct tm *t;
           time_t curr_time;
   
           if (diff_rev1 != NULL) {
                   t = gmtime(&stb1.st_mtime);
           } else {
                   time(&curr_time);
                   t = localtime(&curr_time);
           }
   
           (void)strftime(buf, sizeof(buf), "%d %b %G %H:%M:%S -0000", t);
           diff_output("%s %s      %s", diff_format == D_CONTEXT ? "***" : "---",
               diff_file, buf);
   
           if (diff_rev1 != NULL) {
                   rcsnum_tostr(diff_rev1, buf, sizeof(buf));
                   diff_output("\t%s", buf);
           }
   
           diff_output("\n");
   
           if (diff_rev2 != NULL)
                   t = gmtime(&stb2.st_mtime);
           else {
                   time(&curr_time);
                   t = localtime(&curr_time);
           }
   
           (void)strftime(buf, sizeof(buf), "%d %b %G %H:%M:%S -0000", t);
           diff_output("%s %s      %s", diff_format == D_CONTEXT ? "---" : "+++",
               diff_file, buf);
   
           if (diff_rev2 != NULL) {
                   rcsnum_tostr(diff_rev2, buf, sizeof(buf));
                   diff_output("\t%s", buf);
           }
   
           diff_output("\n");
   }
   
   static void
   rdiff_head(void)
   {
           char buf[64];
           struct tm *t;
           time_t curr_time;
   
           if (diff_rev1 != NULL) {
                   t = localtime(&stb1.st_mtime);
           } else {
                   time(&curr_time);
                   t = localtime(&curr_time);
           }
   
           diff_output("%s ", diff_format == D_CONTEXT ? "***" : "---");
   
           if (diff_rev1 == NULL) {
                   diff_output("%s", CVS_PATH_DEVNULL);
                   t = gmtime(&stb1.st_atime);
           } else {
                   rcsnum_tostr(diff_rev1, buf, sizeof(buf));
                   diff_output("%s:%s", diff_file, buf);
           }
   
           (void)strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %G", t);
           diff_output("\t%s\n", buf);
   
           if (diff_rev2 != NULL) {
                   t = localtime(&stb2.st_mtime);
           } else {
                   time(&curr_time);
                   t = localtime(&curr_time);
           }
   
           (void)strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %G", t);
   
           diff_output("%s %s      %s\n", diff_format == D_CONTEXT ? "---" : "+++",
               diff_file, buf);
   }
   
 /*  /*
  * Indicate that there is a difference between lines a and b of the from file   * Indicate that there is a difference between lines a and b of the from file
  * to get to lines c to d of the to file.  If a is greater then b then there   * to get to lines c to d of the to file.  If a is greater then b then there
Line 863 
Line 950 
 change(FILE *f1, FILE *f2, int a, int b, int c, int d)  change(FILE *f1, FILE *f2, int a, int b, int c, int d)
 {  {
         static size_t max_context = 64;          static size_t max_context = 64;
         char buf[64];  
         struct tm *t;  
         int i;          int i;
   
         if (diff_format != D_IFDEF && a > b && c > d)          if (diff_format != D_IFDEF && a > b && c > d)
Line 911 
Line 996 
                         /*                          /*
                          * Print the context/unidiff header first time through.                           * Print the context/unidiff header first time through.
                          */                           */
                         t = localtime(&stb1.st_mtime);                          if (cvs_cmdop == CVS_OP_RDIFF)
                         (void)strftime(buf, sizeof(buf),                                  rdiff_head();
                             "%d %b %G %H:%M:%S", t);                          else
                                   diff_head();
   
                         diff_output("%s %s      %s",  
                             diff_format == D_CONTEXT ? "***" : "---", diff_file,  
                             buf);  
   
                         if (diff_rev1 != NULL) {  
                                 rcsnum_tostr(diff_rev1, buf, sizeof(buf));  
                                 diff_output("\t%s", buf);  
                         }  
   
                         diff_output("\n");  
   
                         t = localtime(&stb2.st_mtime);  
                         (void)strftime(buf, sizeof(buf),  
                             "%d %b %G %H:%M:%S", t);  
   
                         diff_output("%s %s      %s",  
                             diff_format == D_CONTEXT ? "---" : "+++", diff_file,  
                             buf);  
   
                         if (diff_rev2 != NULL) {  
                                 rcsnum_tostr(diff_rev2, buf, sizeof(buf));  
                                 diff_output("\t%s", buf);  
                         }  
   
                         diff_output("\n");  
                         anychange = 1;                          anychange = 1;
                 } else if (a > context_vec_ptr->b + (2 * context) + 1 &&                  } else if (a > context_vec_ptr->b + (2 * context) + 1 &&
                     c > context_vec_ptr->d + (2 * context) + 1) {                      c > context_vec_ptr->d + (2 * context) + 1) {
Line 1072 
Line 1133 
         sum = 1;          sum = 1;
         space = 0;          space = 0;
         if (bflag != 1 && wflag != 1) {          if (bflag != 1 && wflag != 1) {
                 if (iflag == 1)                  if (diff_iflag == 1)
                         for (i = 0; (t = getc(f)) != '\n'; i++) {                          for (i = 0; (t = getc(f)) != '\n'; i++) {
                                 if (t == EOF) {                                  if (t == EOF) {
                                         if (i == 0)                                          if (i == 0)

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17