version 1.37, 2003/07/17 20:06:01 |
version 1.38, 2003/07/18 20:43:18 |
|
|
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; |
|
|
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; |
|
|
|
|
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); |
|
|
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; |
} |
} |
|
|
} |
} |
|
|
/* 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); |
|
|
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; |
} |
} |