- /* find files to extract or display */
- while (extract_list->next != NULL) {
- if (funct & extract_to_file) {
- dst_file = wfopen(extract_list->name, "w");
- }
- else if (funct & extract_to_stdout) {
- dst_file = stdout;
- }
- if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
- fseek(src_file, extract_list->offset, SEEK_SET);
- copy_file_chunk(src_file, dst_file, (off_t) extract_list->size);
- }
- if (funct & verbose) {
- printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
- extract_list->uid, extract_list->gid,
- (int) extract_list->size, time_string(extract_list->mtime));
- }
- if ((funct & display) || (funct & verbose)){
- printf("%s\n", extract_list->name);
- }
- extract_list=extract_list->next;
+ archive_xread_all(archive_handle, magic, 7);
+ if (strncmp(magic, "!<arch>", 7) != 0) {
+ bb_error_msg_and_die("Invalid ar magic");