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

Diff for /src/usr.bin/compress/main.c between version 1.37 and 1.38

version 1.37, 2003/07/17 20:06:01 version 1.38, 2003/07/18 20:43:18
Line 138 
Line 138 
         int bits, exists, oreg, ch, error, i, rc, oflag;          int bits, exists, oreg, ch, error, i, rc, oflag;
   
         bits = cat = oflag = decomp = 0;          bits = cat = oflag = decomp = 0;
           nosave = -1;
         p = __progname;          p = __progname;
         if (p[0] == 'g') {          if (p[0] == 'g') {
                 method = M_DEFLATE;                  method = M_DEFLATE;
Line 232 
Line 233 
                         nosave = 1;                          nosave = 1;
                         break;                          break;
                 case 'N':                  case 'N':
                         nosave = -1;                          nosave = 0;
                         break;                          break;
                 case 'O':                  case 'O':
                         method = M_COMPRESS;                          method = M_COMPRESS;
Line 304 
Line 305 
   
         if ((cat && argc) + testmode + oflag > 1)          if ((cat && argc) + testmode + oflag > 1)
                 errx(1, "may not mix -o, -c, or -t options");                  errx(1, "may not mix -o, -c, or -t options");
           if (nosave == -1)
                   nosave = decomp;
   
         if ((ftsp = fts_open(argv, FTS_PHYSICAL|FTS_NOCHDIR, 0)) == NULL)          if ((ftsp = fts_open(argv, FTS_PHYSICAL|FTS_NOCHDIR, 0)) == NULL)
                 err(1, NULL);                  err(1, NULL);
Line 461 
Line 464 
                 return (FAILURE);                  return (FAILURE);
         }          }
   
         if (!pipin && nosave <= 0) {          if (!pipin && !nosave) {
                 name = basename(in);                  name = basename(in);
                 mtime = (u_int32_t)sb->st_mtime;                  mtime = (u_int32_t)sb->st_mtime;
         }          }
Line 562 
Line 565 
         }          }
   
         /* XXX - open constrains outfile to MAXPATHLEN so this is safe */          /* XXX - open constrains outfile to MAXPATHLEN so this is safe */
         if ((cookie = (*method->open)(ifd, "r", nosave < 0 ? out : NULL,          if ((cookie = (*method->open)(ifd, "r", nosave ? NULL : out,
             bits, 0, 1)) == NULL) {              bits, 0, 1)) == NULL) {
                 if (verbose >= 0)                  if (verbose >= 0)
                         warn("%s", in);                          warn("%s", in);
Line 601 
Line 604 
                 error = FAILURE;                  error = FAILURE;
         }          }
   
         if (nosave < 0) {          if (!nosave) {
                 sb->st_mtimespec.tv_sec = info.mtime;                  sb->st_mtimespec.tv_sec = info.mtime;
                 sb->st_mtimespec.tv_nsec = 0;                  sb->st_mtimespec.tv_nsec = 0;
         }          }

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38