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

Diff for /src/usr.bin/rcs/rcsprog.c between version 1.117 and 1.118

version 1.117, 2006/04/26 02:55:13 version 1.118, 2006/04/26 21:55:22
Line 174 
Line 174 
 int  int
 rcs_main(int argc, char **argv)  rcs_main(int argc, char **argv)
 {  {
           int fd, ofd;
         int i, j, ch, flags, kflag, lkmode;          int i, j, ch, flags, kflag, lkmode;
         char fpath[MAXPATHLEN], ofpath[MAXPATHLEN];          char fpath[MAXPATHLEN], ofpath[MAXPATHLEN];
         char *logstr, *logmsg, *nflag, *descfile;          char *logstr, *logmsg, *nflag, *descfile;
Line 196 
Line 197 
                 warnx("warning: No options were given; "                  warnx("warning: No options were given; "
                     "this usage is obsolescent.");                      "this usage is obsolescent.");
   
           ofd = -1;
         while ((ch = rcs_getopt(argc, argv, RCSPROG_OPTSTRING)) != -1) {          while ((ch = rcs_getopt(argc, argv, RCSPROG_OPTSTRING)) != -1) {
                 switch (ch) {                  switch (ch) {
                 case 'A':                  case 'A':
                         if (rcs_statfile(rcs_optarg, ofpath,                          ofd = rcs_statfile(rcs_optarg, ofpath,
                             sizeof(ofpath), flags) < 0)                              sizeof(ofpath), flags);
                           if (ofd < 0)
                                 exit(1);                                  exit(1);
                         rcsflags |= CO_ACLAPPEND;                          rcsflags |= CO_ACLAPPEND;
                         break;                          break;
Line 300 
Line 303 
         }          }
   
         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 && !(flags & RCS_CREATE))
                         continue;                          continue;
   
                 if (!(rcsflags & QUIET))                  if (!(rcsflags & QUIET))
                         printf("RCS file: %s\n", fpath);                          printf("RCS file: %s\n", fpath);
   
                 if ((file = rcs_open(fpath, flags, fmode)) == NULL)                  if ((file = rcs_open(fpath, fd, flags, fmode)) == NULL)
                         continue;                          continue;
   
                 if (rcsflags & DESCRIPTION)                  if (rcsflags & DESCRIPTION)
Line 315 
Line 319 
                         rcs_set_description(file, NULL);                          rcs_set_description(file, NULL);
   
                 if (rcsflags & PRESERVETIME)                  if (rcsflags & PRESERVETIME)
                         rcs_mtime = rcs_get_mtime(file->rf_path);                          rcs_mtime = rcs_get_mtime(file);
   
                 if (nflag != NULL)                  if (nflag != NULL)
                         rcs_attach_symbol(file, nflag);                          rcs_attach_symbol(file, nflag);
Line 348 
Line 352 
                 /* entries to add from <oldfile> */                  /* entries to add from <oldfile> */
                 if (rcsflags & CO_ACLAPPEND) {                  if (rcsflags & CO_ACLAPPEND) {
                         /* XXX */                          /* XXX */
                         if ((oldfile = rcs_open(ofpath, RCS_READ)) == NULL)                          if ((oldfile = rcs_open(ofpath, ofd, RCS_READ)) == NULL)
                                 exit(1);                                  exit(1);
   
                         TAILQ_FOREACH(acp, &(oldfile->rf_access), ra_list)                          TAILQ_FOREACH(acp, &(oldfile->rf_access), ra_list)
                                 rcs_access_add(file, acp->ra_name);                                  rcs_access_add(file, acp->ra_name);
   
                         rcs_close(oldfile);                          rcs_close(oldfile);
                           ofd = -1;
                 }                  }
   
                 /* entries to add to the access list */                  /* entries to add to the access list */
Line 467 
Line 472 
                         }                          }
                 }                  }
   
                 rcs_close(file);                  rcs_write(file);
   
                 if (rcsflags & PRESERVETIME)                  if (rcsflags & PRESERVETIME)
                         rcs_set_mtime(fpath, rcs_mtime);                          rcs_set_mtime(file, rcs_mtime);
   
                   rcs_close(file);
   
                 if (!(rcsflags & QUIET))                  if (!(rcsflags & QUIET))
                         printf("done\n");                          printf("done\n");
         }          }
Line 484 
Line 491 
   
         if (orange != NULL)          if (orange != NULL)
                 xfree(orange);                  xfree(orange);
   
           if (ofd != -1)
                   (void)close(ofd);
   
         return (0);          return (0);
 }  }

Legend:
Removed from v.1.117  
changed lines
  Added in v.1.118