Argh - both gzip.c and libbz have a "decompress" symbol. For now,
rename gzip.c's decompress to de_compress. I emailed the author of libbz back in December about this and haven't heard anything since... Thanks to enami tsugutomo for pointing this out.
This commit is contained in:
parent
f48807a678
commit
a8733a30d9
|
@ -45,7 +45,7 @@ static char *license_msg[] = {
|
|||
*/
|
||||
|
||||
#ifdef RCSID
|
||||
static char rcsid[] = "$Id: gzip.c,v 1.4 1999/07/25 07:06:06 simonb Exp $";
|
||||
static char rcsid[] = "$Id: gzip.c,v 1.5 1999/07/27 00:36:10 simonb Exp $";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -200,7 +200,7 @@ DECLARE(uch, window, 2L*WSIZE);
|
|||
|
||||
int ascii = 0; /* convert end-of-lines to local OS conventions */
|
||||
int to_stdout = 0; /* output to stdout (-c) */
|
||||
int decompress = 0; /* decompress (-d) */
|
||||
int de_compress = 0; /* decompress (-d) */
|
||||
int force = 0; /* don't ask questions, compress links (-f) */
|
||||
int no_name = -1; /* don't save or restore the original file name */
|
||||
int no_time = -1; /* don't save or restore the original file time */
|
||||
|
@ -468,10 +468,10 @@ int main (argc, argv)
|
|||
*/
|
||||
if ( strncmp(progname, "un", 2) == 0 /* ungzip, uncompress */
|
||||
|| strncmp(progname, "gun", 3) == 0) { /* gunzip */
|
||||
decompress = 1;
|
||||
de_compress = 1;
|
||||
} else if (strequ(progname+1, "cat") /* zcat, pcat, gcat */
|
||||
|| strequ(progname, "gzcat")) { /* gzcat */
|
||||
decompress = to_stdout = 1;
|
||||
de_compress = to_stdout = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -489,13 +489,13 @@ int main (argc, argv)
|
|||
case 'c':
|
||||
to_stdout = 1; break;
|
||||
case 'd':
|
||||
decompress = 1; break;
|
||||
de_compress = 1; break;
|
||||
case 'f':
|
||||
force++; break;
|
||||
case 'h': case 'H': case '?':
|
||||
help(); do_exit(OK); break;
|
||||
case 'l':
|
||||
list = decompress = to_stdout = 1; break;
|
||||
list = de_compress = to_stdout = 1; break;
|
||||
case 'L':
|
||||
license(); do_exit(OK); break;
|
||||
case 'm': /* undocumented, may change later */
|
||||
|
@ -524,7 +524,7 @@ int main (argc, argv)
|
|||
strcpy(z_suffix, optarg);
|
||||
break;
|
||||
case 't':
|
||||
test = decompress = to_stdout = 1;
|
||||
test = de_compress = to_stdout = 1;
|
||||
break;
|
||||
case 'v':
|
||||
verbose++; quiet = 0; break;
|
||||
|
@ -553,8 +553,8 @@ int main (argc, argv)
|
|||
/* By default, save name and timestamp on compression but do not
|
||||
* restore them on decompression.
|
||||
*/
|
||||
if (no_time < 0) no_time = decompress;
|
||||
if (no_name < 0) no_name = decompress;
|
||||
if (no_time < 0) no_time = de_compress;
|
||||
if (no_name < 0) no_name = de_compress;
|
||||
|
||||
file_count = argc - optind;
|
||||
|
||||
|
@ -565,12 +565,12 @@ int main (argc, argv)
|
|||
progname);
|
||||
}
|
||||
#endif
|
||||
if ((z_len == 0 && !decompress) || z_len > MAX_SUFFIX) {
|
||||
if ((z_len == 0 && !de_compress) || z_len > MAX_SUFFIX) {
|
||||
fprintf(stderr, "%s: incorrect suffix '%s'\n",
|
||||
progname, optarg);
|
||||
do_exit(ERROR);
|
||||
}
|
||||
if (do_lzw && !decompress) work = lzw;
|
||||
if (do_lzw && !de_compress) work = lzw;
|
||||
|
||||
/* Allocate all global buffers (for DYN_ALLOC option) */
|
||||
ALLOC(uch, inbuf, INBUFSIZ +INBUF_EXTRA);
|
||||
|
@ -586,7 +586,7 @@ int main (argc, argv)
|
|||
|
||||
/* And get to work */
|
||||
if (file_count != 0) {
|
||||
if (to_stdout && !test && !list && (!decompress || !ascii)) {
|
||||
if (to_stdout && !test && !list && (!de_compress || !ascii)) {
|
||||
SET_BINARY_MODE(fileno(stdout));
|
||||
}
|
||||
while (optind < argc) {
|
||||
|
@ -608,7 +608,7 @@ int main (argc, argv)
|
|||
local void treat_stdin()
|
||||
{
|
||||
if (!force && !list &&
|
||||
isatty(fileno((FILE *)(decompress ? stdin : stdout)))) {
|
||||
isatty(fileno((FILE *)(de_compress ? stdin : stdout)))) {
|
||||
/* Do not send compressed data to the terminal or read it from
|
||||
* the terminal. We get here when user invoked the program
|
||||
* without parameters, so be helpful. According to the GNU standards:
|
||||
|
@ -623,16 +623,16 @@ local void treat_stdin()
|
|||
*/
|
||||
fprintf(stderr,
|
||||
"%s: compressed data not %s a terminal. Use -f to force %scompression.\n",
|
||||
progname, decompress ? "read from" : "written to",
|
||||
decompress ? "de" : "");
|
||||
progname, de_compress ? "read from" : "written to",
|
||||
de_compress ? "de" : "");
|
||||
fprintf(stderr,"For help, type: %s -h\n", progname);
|
||||
do_exit(ERROR);
|
||||
}
|
||||
|
||||
if (decompress || !ascii) {
|
||||
if (de_compress || !ascii) {
|
||||
SET_BINARY_MODE(fileno(stdin));
|
||||
}
|
||||
if (!test && !list && (!decompress || !ascii)) {
|
||||
if (!test && !list && (!de_compress || !ascii)) {
|
||||
SET_BINARY_MODE(fileno(stdout));
|
||||
}
|
||||
strcpy(ifname, "stdin");
|
||||
|
@ -658,7 +658,7 @@ local void treat_stdin()
|
|||
to_stdout = 1;
|
||||
part_nb = 0;
|
||||
|
||||
if (decompress) {
|
||||
if (de_compress) {
|
||||
method = get_method(ifd);
|
||||
if (method < 0) {
|
||||
do_exit(exit_code); /* error message already emitted */
|
||||
|
@ -674,7 +674,7 @@ local void treat_stdin()
|
|||
for (;;) {
|
||||
if ((*work)(fileno(stdin), fileno(stdout)) != OK) return;
|
||||
|
||||
if (!decompress || last_member || inptr == insize) break;
|
||||
if (!de_compress || last_member || inptr == insize) break;
|
||||
/* end of file */
|
||||
|
||||
method = get_method(ifd);
|
||||
|
@ -686,7 +686,7 @@ local void treat_stdin()
|
|||
if (test) {
|
||||
fprintf(stderr, " OK\n");
|
||||
|
||||
} else if (!decompress) {
|
||||
} else if (!de_compress) {
|
||||
display_ratio(bytes_in-(bytes_out-header_bytes), bytes_in, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
#ifdef DISPLAY_STDIN_RATIO
|
||||
|
@ -761,7 +761,7 @@ local void treat_file(iname)
|
|||
* parameter is ignored but required by some systems (VMS) and forbidden
|
||||
* on other systems (MacOS).
|
||||
*/
|
||||
ifd = OPEN(ifname, ascii && !decompress ? O_RDONLY : O_RDONLY | O_BINARY,
|
||||
ifd = OPEN(ifname, ascii && !de_compress ? O_RDONLY : O_RDONLY | O_BINARY,
|
||||
RW_USER);
|
||||
if (ifd == -1) {
|
||||
fprintf(stderr, "%s: ", progname);
|
||||
|
@ -772,7 +772,7 @@ local void treat_file(iname)
|
|||
clear_bufs(); /* clear input and output buffers */
|
||||
part_nb = 0;
|
||||
|
||||
if (decompress) {
|
||||
if (de_compress) {
|
||||
method = get_method(ifd); /* updates ofname if original given */
|
||||
if (method < 0) {
|
||||
close(ifd);
|
||||
|
@ -795,7 +795,7 @@ local void treat_file(iname)
|
|||
} else {
|
||||
if (create_outfile() != OK) return;
|
||||
|
||||
if (!decompress && save_orig_name && !verbose && !quiet) {
|
||||
if (!de_compress && save_orig_name && !verbose && !quiet) {
|
||||
fprintf(stderr, "%s: %s compressed to %s\n",
|
||||
progname, ifname, ofname);
|
||||
}
|
||||
|
@ -815,7 +815,7 @@ local void treat_file(iname)
|
|||
method = -1; /* force cleanup */
|
||||
break;
|
||||
}
|
||||
if (!decompress || last_member || inptr == insize) break;
|
||||
if (!de_compress || last_member || inptr == insize) break;
|
||||
/* end of file */
|
||||
|
||||
method = get_method(ifd);
|
||||
|
@ -835,7 +835,7 @@ local void treat_file(iname)
|
|||
if(verbose) {
|
||||
if (test) {
|
||||
fprintf(stderr, " OK");
|
||||
} else if (decompress) {
|
||||
} else if (de_compress) {
|
||||
display_ratio(bytes_out-(bytes_in-header_bytes), bytes_out,stderr);
|
||||
} else {
|
||||
display_ratio(bytes_in-(bytes_out-header_bytes), bytes_in, stderr);
|
||||
|
@ -865,7 +865,7 @@ local int create_outfile()
|
|||
struct stat ostat; /* stat for ofname */
|
||||
int flags = O_WRONLY | O_CREAT | O_EXCL | O_BINARY;
|
||||
|
||||
if (ascii && decompress) {
|
||||
if (ascii && de_compress) {
|
||||
flags &= ~O_BINARY; /* force ascii text mode */
|
||||
}
|
||||
for (;;) {
|
||||
|
@ -899,7 +899,7 @@ local int create_outfile()
|
|||
}
|
||||
if (!name_too_long(ofname, &ostat)) return OK;
|
||||
|
||||
if (decompress) {
|
||||
if (de_compress) {
|
||||
/* name might be too long if an original name was saved */
|
||||
WARN((stderr, "%s: %s: warning, name truncated\n",
|
||||
progname, ofname));
|
||||
|
@ -1011,7 +1011,7 @@ local int get_istat(iname, sbuf)
|
|||
/* If input file exists, return OK. */
|
||||
if (do_stat(ifname, sbuf) == 0) return OK;
|
||||
|
||||
if (!decompress || errno != ENOENT) {
|
||||
if (!de_compress || errno != ENOENT) {
|
||||
perror(ifname);
|
||||
exit_code = ERROR;
|
||||
return ERROR;
|
||||
|
@ -1077,7 +1077,7 @@ local int make_ofname()
|
|||
/* strip a version number if any and get the gzip suffix if present: */
|
||||
suff = get_suffix(ofname);
|
||||
|
||||
if (decompress) {
|
||||
if (de_compress) {
|
||||
if (suff == NULL) {
|
||||
/* Whith -t or -l, try all files (even without .gz suffix)
|
||||
* except with -r (behave as with just -dr).
|
||||
|
@ -1132,7 +1132,7 @@ local int make_ofname()
|
|||
#endif /* NO_MULTIPLE_DOTS */
|
||||
strcat(ofname, z_suffix);
|
||||
|
||||
} /* decompress ? */
|
||||
} /* de_compress ? */
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -1471,7 +1471,7 @@ local void shorten_name(name)
|
|||
char *p;
|
||||
|
||||
len = strlen(name);
|
||||
if (decompress) {
|
||||
if (de_compress) {
|
||||
if (len <= 1) error("name too short");
|
||||
name[len-1] = '\0';
|
||||
return;
|
||||
|
@ -1547,7 +1547,7 @@ local int check_ofname()
|
|||
* defining ENAMETOOLONG, because on most systems the strict Posix
|
||||
* behavior is disabled by default (silent name truncation allowed).
|
||||
*/
|
||||
if (!decompress && name_too_long(ofname, &ostat)) {
|
||||
if (!de_compress && name_too_long(ofname, &ostat)) {
|
||||
shorten_name(ofname);
|
||||
if (stat(ofname, &ostat) != 0) return 0;
|
||||
}
|
||||
|
@ -1558,7 +1558,7 @@ local int check_ofname()
|
|||
if (same_file(&istat, &ostat)) {
|
||||
if (strequ(ifname, ofname)) {
|
||||
fprintf(stderr, "%s: %s: cannot %scompress onto itself\n",
|
||||
progname, ifname, decompress ? "de" : "");
|
||||
progname, ifname, de_compress ? "de" : "");
|
||||
} else {
|
||||
fprintf(stderr, "%s: %s and %s are the same file\n",
|
||||
progname, ifname, ofname);
|
||||
|
@ -1623,7 +1623,7 @@ local void copy_stat(ifstat)
|
|||
struct stat *ifstat;
|
||||
{
|
||||
#ifndef NO_UTIME
|
||||
if (decompress && time_stamp != 0 && ifstat->st_mtime != time_stamp) {
|
||||
if (de_compress && time_stamp != 0 && ifstat->st_mtime != time_stamp) {
|
||||
ifstat->st_mtime = time_stamp;
|
||||
if (verbose > 1) {
|
||||
fprintf(stderr, "%s: time stamp restored\n", ofname);
|
||||
|
|
Loading…
Reference in New Issue