summaryrefslogtreecommitdiff
path: root/libbb/get_ar_headers.c
diff options
context:
space:
mode:
authorGlenn L McGrath2001-06-13 07:26:39 +0000
committerGlenn L McGrath2001-06-13 07:26:39 +0000
commit9aff9036035fbed074e8e711b96c5c934e668884 (patch)
tree4db8fdd4b9f429b416d068794c79bfc0df844e20 /libbb/get_ar_headers.c
parentdab3d46b9d35e0a0279b3700fe411f876bb25781 (diff)
downloadbusybox-9aff9036035fbed074e8e711b96c5c934e668884.zip
busybox-9aff9036035fbed074e8e711b96c5c934e668884.tar.gz
Reorganise archive extraction code
Diffstat (limited to 'libbb/get_ar_headers.c')
-rw-r--r--libbb/get_ar_headers.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libbb/get_ar_headers.c b/libbb/get_ar_headers.c
index 151caaf..414498b 100644
--- a/libbb/get_ar_headers.c
+++ b/libbb/get_ar_headers.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "libbb.h"
-extern ar_headers_t *get_ar_headers(FILE *in_file)
+file_headers_t *get_ar_headers(FILE *in_file)
{
typedef struct raw_ar_header_s { /* Byte Offset */
char name[16]; /* 0-15 */
@@ -44,7 +44,7 @@ extern ar_headers_t *get_ar_headers(FILE *in_file)
raw_ar_header_t raw_ar_header;
- ar_headers_t *ar_list, *ar_tmp, *ar_entry;
+ file_headers_t *ar_list, *ar_entry;
char ar_magic[8];
char *long_name=NULL;
@@ -59,10 +59,10 @@ extern ar_headers_t *get_ar_headers(FILE *in_file)
return(NULL);
}
- ar_list = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
+ ar_list = (file_headers_t *) xcalloc(1, sizeof(file_headers_t));
while (fread((char *) &raw_ar_header, 1, 60, in_file) == 60) {
- ar_entry = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
+ ar_entry = (file_headers_t *) xcalloc(1, sizeof(file_headers_t));
/* check the end of header markers are valid */
if ((raw_ar_header.fmag[0] != '`') || (raw_ar_header.fmag[1] != '\n')) {
char newline;
@@ -113,12 +113,7 @@ extern ar_headers_t *get_ar_headers(FILE *in_file)
fseek(in_file, (off_t) ar_entry->size, SEEK_CUR);
- ar_tmp = (ar_headers_t *) xcalloc(1, sizeof(ar_headers_t));
- *ar_tmp = *ar_list;
- *ar_list = *ar_entry;
- free(ar_entry);
- ar_list->next = ar_tmp;
+ ar_list = append_archive_list(ar_list, ar_entry);
}
-
return(ar_list);
}