- /* Check that the input is sane. */
- if (isatty(fileno(in_file)) && (flags & gunzip_force) == 0)
- error_msg_and_die("compressed data not read from terminal. Use -f to force it.");
-
- /* Set output filename and number */
- if (flags & gunzip_test) {
- out_file = xfopen("/dev/null", "w"); /* why does test use filenum 2 ? */
- } else if (flags & gunzip_to_stdout) {
- out_file = stdout;
- } else {
- char *extension;
- int length = strlen(if_name);
-
- delete_old_file = TRUE;
- extension = strrchr(if_name, '.');
- if (extension && strcmp(extension, ".gz") == 0) {
- length -= 3;
- } else if (extension && strcmp(extension, ".tgz") == 0) {
- length -= 4;
+ if (old_path == NULL || strcmp(old_path, "-") == 0) {
+ src_fd = fileno(stdin);
+ flags |= gunzip_to_stdout;