Sigh. Seems I screwed up last time. This fixed detecting

when on a console or not, and make default behavior compatible
with GNU gzip...
 -Erik
This commit is contained in:
Eric Andersen 2000-09-01 00:33:06 +00:00
parent 4e61db2284
commit 5eb5912790
2 changed files with 6 additions and 8 deletions

View File

@ -1802,9 +1802,6 @@ int gzip_main(int argc, char **argv)
int fromstdin = 0;
int force = 0;
if (argc == 1)
usage(gzip_usage);
/* Parse any options */
while (--argc > 0 && **(++argv) == '-') {
if (*((*argv) + 1) == '\0') {
@ -1827,8 +1824,10 @@ int gzip_main(int argc, char **argv)
}
}
}
if (argc <= 0)
if (argc <= 0 ) {
fromstdin = 1;
tostdout = 1;
}
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
fatalError( "data not read from terminal. Use -f to force it.\n");

7
gzip.c
View File

@ -1802,9 +1802,6 @@ int gzip_main(int argc, char **argv)
int fromstdin = 0;
int force = 0;
if (argc == 1)
usage(gzip_usage);
/* Parse any options */
while (--argc > 0 && **(++argv) == '-') {
if (*((*argv) + 1) == '\0') {
@ -1827,8 +1824,10 @@ int gzip_main(int argc, char **argv)
}
}
}
if (argc <= 0)
if (argc <= 0 ) {
fromstdin = 1;
tostdout = 1;
}
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
fatalError( "data not read from terminal. Use -f to force it.\n");