Allow unarchive to redirect stdout (tobe used by dpkg applet)

This commit is contained in:
Glenn L McGrath 2001-07-11 17:32:14 +00:00
parent 481d19b38e
commit c127008840
7 changed files with 9 additions and 9 deletions

2
ar.c
View File

@ -84,6 +84,6 @@ extern int ar_main(int argc, char **argv)
optind++; optind++;
} }
unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names); unarchive(src_stream, stdout, &get_header_ar, extract_function, "./", extract_names);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -84,6 +84,6 @@ extern int ar_main(int argc, char **argv)
optind++; optind++;
} }
unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names); unarchive(src_stream, stdout, &get_header_ar, extract_function, "./", extract_names);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -85,7 +85,7 @@ extern int cpio_main(int argc, char **argv)
optind++; optind++;
} }
unarchive(src_stream, &get_header_cpio, extract_function, "./", extract_names); unarchive(src_stream, stdout, &get_header_cpio, extract_function, "./", extract_names);
if (oldmask) umask(oldmask); /* Restore umask if we changed it */ if (oldmask) umask(oldmask); /* Restore umask if we changed it */
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

2
cpio.c
View File

@ -85,7 +85,7 @@ extern int cpio_main(int argc, char **argv)
optind++; optind++;
} }
unarchive(src_stream, &get_header_cpio, extract_function, "./", extract_names); unarchive(src_stream, stdout, &get_header_cpio, extract_function, "./", extract_names);
if (oldmask) umask(oldmask); /* Restore umask if we changed it */ if (oldmask) umask(oldmask); /* Restore umask if we changed it */
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -239,7 +239,7 @@ enum extract_functions_e {
extract_unconditional = 512, extract_unconditional = 512,
extract_create_leading_dirs = 1024 extract_create_leading_dirs = 1024
}; };
char *unarchive(FILE *src_stream, file_header_t *(*get_header)(FILE *), char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_header)(FILE *),
const int extract_function, const char *prefix, char **extract_names); const int extract_function, const char *prefix, char **extract_names);
char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function, char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
const char *prefix, const char *filename); const char *prefix, const char *filename);

View File

@ -239,7 +239,7 @@ enum extract_functions_e {
extract_unconditional = 512, extract_unconditional = 512,
extract_create_leading_dirs = 1024 extract_create_leading_dirs = 1024
}; };
char *unarchive(FILE *src_stream, file_header_t *(*get_header)(FILE *), char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_header)(FILE *),
const int extract_function, const char *prefix, char **extract_names); const int extract_function, const char *prefix, char **extract_names);
char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function, char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
const char *prefix, const char *filename); const char *prefix, const char *filename);

View File

@ -211,7 +211,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
#endif #endif
#ifdef L_unarchive #ifdef L_unarchive
char *unarchive(FILE *src_stream, file_header_t *(*get_headers)(FILE *), char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers)(FILE *),
const int extract_function, const char *prefix, char **extract_names) const int extract_function, const char *prefix, char **extract_names)
{ {
file_header_t *file_entry; file_header_t *file_entry;
@ -237,7 +237,7 @@ char *unarchive(FILE *src_stream, file_header_t *(*get_headers)(FILE *),
continue; continue;
} }
} }
buffer = extract_archive(src_stream, stdout, file_entry, extract_function, prefix); buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix);
} }
return(buffer); return(buffer);
} }
@ -568,7 +568,7 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
/* open a stream of decompressed data */ /* open a stream of decompressed data */
uncompressed_stream = gz_open(deb_stream, &gunzip_pid); uncompressed_stream = gz_open(deb_stream, &gunzip_pid);
archive_offset = 0; archive_offset = 0;
output_buffer = unarchive(uncompressed_stream, get_header_tar, extract_function, prefix, file_list); output_buffer = unarchive(uncompressed_stream, out_stream, get_header_tar, extract_function, prefix, file_list);
} }
seek_sub_file(deb_stream, ar_header->size); seek_sub_file(deb_stream, ar_header->size);
} }