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

Diff for /src/usr.bin/cvs/edit.c between version 1.23 and 1.24

version 1.23, 2007/01/06 17:09:08 version 1.24, 2007/01/08 13:21:21
Line 255 
Line 255 
         if (cvs_noexec == 1)          if (cvs_noexec == 1)
                 return;                  return;
   
           cvs_log(LP_TRACE, "cvs_edit_local(%s)", cf->file_path);
   
         cvs_file_classify(cf, NULL, 0);          cvs_file_classify(cf, NULL, 0);
   
         if ((fp = fopen(CVS_PATH_NOTIFY, "a")) == NULL)          if ((fp = fopen(CVS_PATH_NOTIFY, "a")) == NULL)
Line 321 
Line 323 
         struct tm *t;          struct tm *t;
         time_t now;          time_t now;
         char *bfpath, timebuf[64], thishost[MAXHOSTNAMELEN], wdir[MAXPATHLEN];          char *bfpath, timebuf[64], thishost[MAXHOSTNAMELEN], wdir[MAXPATHLEN];
           RCSNUM *ba_rev;
   
         if (cvs_noexec == 1)          if (cvs_noexec == 1)
                 return;                  return;
   
           cvs_log(LP_TRACE, "cvs_unedit_local(%s)", cf->file_path);
   
         cvs_file_classify(cf, NULL, 0);          cvs_file_classify(cf, NULL, 0);
   
         bfpath = xmalloc(MAXPATHLEN);          bfpath = xmalloc(MAXPATHLEN);
Line 374 
Line 379 
         (void)fclose(fp);          (void)fclose(fp);
   
         /* XXX: Update the revision number in CVS/Entries from CVS/Baserev */          /* XXX: Update the revision number in CVS/Entries from CVS/Baserev */
           if (cf->file_ent != NULL) {
                   if ((ba_rev = cvs_base_handle(cf, BASE_GET)) == NULL) {
                           cvs_log(LP_ERR, "%s not mentioned in %s",
                               cf->file_name, CVS_PATH_BASEREV);
                           return;
                   }
                   rcsnum_free(ba_rev);
           }
   
           (void)cvs_base_handle(cf, BASE_REMOVE);
   
         if (fchmod(cf->fd, 0644) == -1)          if (fchmod(cf->fd, 0644) == -1)
                 fatal("cvs_unedit_local: fchmod %s", strerror(errno));                  fatal("cvs_unedit_local: fchmod %s", strerror(errno));
 }  }
Line 385 
Line 400 
         FILE *fp, *tfp;          FILE *fp, *tfp;
         RCSNUM *ba_rev;          RCSNUM *ba_rev;
         size_t len;          size_t len;
         char *filename, *filerev, *p;          int i;
         char buf[MAXPATHLEN], rbuf[16];          char *dp, *sp;
           char buf[MAXPATHLEN], *fields[2], rbuf[16];
   
         cvs_log(LP_TRACE, "cvs_base_handle(%s)", cf->file_path);          cvs_log(LP_TRACE, "cvs_base_handle(%s)", cf->file_path);
   
         tfp = NULL;          tfp = NULL;
         ba_rev = NULL;          ba_rev = NULL;
   
         if ((fp = fopen(CVS_PATH_BASEREV, "r")) == NULL) {          if (((fp = fopen(CVS_PATH_BASEREV, "r")) == NULL) && errno != ENOENT) {
                 cvs_log(LP_ERRNO, "%s", CVS_PATH_BASEREV);                  cvs_log(LP_ERRNO, "%s", CVS_PATH_BASEREV);
                 goto out;                  goto out;
         }          }
Line 405 
Line 421 
                 }                  }
         }          }
   
         while(fgets(buf, sizeof(buf), fp)) {          if (fp != NULL) {
                 len = strlen(buf);                  while(fgets(buf, sizeof(buf), fp)) {
                 if (len > 0 && buf[len - 1] == '\n')                          len = strlen(buf);
                         buf[len - 1] = '\0';                          if (len > 0 && buf[len - 1] == '\n')
                                   buf[len - 1] = '\0';
   
                 if (buf[0] != 'B')                          if (buf[0] != 'B')
                         continue;                                  continue;
   
                 filename = buf;                          sp = buf + 1;
                 if((p = strchr(filename, '/')) == NULL)                          i = 0;
                         continue;                          do {
                                   if ((dp = strchr(sp, '/')) != NULL)
                                           *(dp++) = '\0';
                                   fields[i++] = sp;
                                   sp = dp;
                           } while (dp != NULL && i < 2);
   
                 filerev = p;                          if (cvs_file_cmpname(fields[0], cf->file_path) == 0) {
                 if ((p = strchr(filerev, '/')) == NULL)                                  if (flags & BASE_GET) {
                         continue;                                          ba_rev = rcsnum_parse(fields[1]);
                                           if (ba_rev == NULL)
                 if (cvs_file_cmpname(filename, cf->file_path) == 0) {                                                  fatal("cvs_base_handle: "
                         if (flags & BASE_GET) {                                                      "rcsnum_parse");
                                 *p = '\0';                                          goto got_rev;
                                 if ((ba_rev = rcsnum_parse(filerev)) == NULL)                                  }
                                         fatal("cvs_base_handle: rcsnum_parse");                          } else {
                                 *p = '/';                                  if (flags & (BASE_ADD|BASE_REMOVE))
                                 goto got_rev;                                          (void)fprintf(tfp, "%s\n", buf);
                         }                          }
                 } else {  
                         if (flags & (BASE_ADD|BASE_REMOVE))  
                                 (void)fprintf(tfp, "%s\n", buf);  
                 }                  }
         }          }
   

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24