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

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

version 1.57, 2006/04/26 02:55:13 version 1.58, 2006/04/26 21:55:22
Line 38 
Line 38 
 int  int
 rcsdiff_main(int argc, char **argv)  rcsdiff_main(int argc, char **argv)
 {  {
         int i, ch, status;          int fd, i, ch, status;
         RCSNUM *rev1, *rev2;          RCSNUM *rev1, *rev2;
         RCSFILE *file;          RCSFILE *file;
         char fpath[MAXPATHLEN], *rev_str1, *rev_str2;          char fpath[MAXPATHLEN], *rev_str1, *rev_str2;
Line 109 
Line 109 
         }          }
   
         for (i = 0; i < argc; i++) {          for (i = 0; i < argc; i++) {
                 if (rcs_statfile(argv[i], fpath, sizeof(fpath), flags) < 0)                  fd = rcs_statfile(argv[i], fpath, sizeof(fpath), flags);
                   if (fd < 0)
                         continue;                          continue;
   
                 if ((file = rcs_open(fpath, RCS_READ|RCS_PARSE_FULLY)) == NULL)                  if ((file = rcs_open(fpath, fd,
                       RCS_READ|RCS_PARSE_FULLY)) == NULL)
                         continue;                          continue;
   
                 rcs_kwexp_set(file, kflag);                  rcs_kwexp_set(file, kflag);
Line 173 
Line 175 
 static int  static int
 rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename)  rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename)
 {  {
         int ret;          int ret, fd;
         time_t t;          time_t t;
           struct stat st;
         char path1[MAXPATHLEN], path2[MAXPATHLEN];          char path1[MAXPATHLEN], path2[MAXPATHLEN];
         BUF *b1, *b2;          BUF *b1, *b2;
         char rbuf[64];          char rbuf[64];
         struct tm *tb;          struct tm *tb;
         struct stat st;  
         struct timeval tv[2], tv2[2];          struct timeval tv[2], tv2[2];
   
         memset(&tv, 0, sizeof(tv));          memset(&tv, 0, sizeof(tv));
Line 191 
Line 193 
         diff_rev1 = rev;          diff_rev1 = rev;
         diff_rev2 = NULL;          diff_rev2 = NULL;
   
         if (stat(filename, &st) == -1) {          if ((fd = open(filename, O_RDONLY)) == -1) {
                 warn("%s", filename);                  warn("%s", filename);
                 goto out;                  goto out;
         }          }
Line 217 
Line 219 
         }          }
   
         /* XXX - GNU uses GMT */          /* XXX - GNU uses GMT */
           if (fstat(fd, &st) == -1)
                   err(1, "%s", filename);
   
         tb = gmtime(&st.st_mtime);          tb = gmtime(&st.st_mtime);
         t = mktime(tb);          t = mktime(tb);
   
Line 247 
Line 252 
         ret = 0;          ret = 0;
   
 out:  out:
           if (fd != -1)
                   (void)close(fd);
         if (b1 != NULL)          if (b1 != NULL)
                 rcs_buf_free(b1);                  rcs_buf_free(b1);
         if (b2 != NULL)          if (b2 != NULL)

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