Seek to start of an entry inside an ar file

This commit is contained in:
Glenn L McGrath 2001-04-11 16:31:20 +00:00
parent 988be100e2
commit b3f23d4c6a

17
libbb/seek_ared_file.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>
#include "libbb.h"
extern int seek_ared_file(FILE *in_file, ar_headers_t *headers, const char *tar_gz_file)
{
/* find the headers for the specified .tar.gz file */
while (headers->next != NULL) {
if (strcmp(headers->name, tar_gz_file) == 0) {
fseek(in_file, headers->offset, SEEK_SET);
return(EXIT_SUCCESS);
}
headers = headers->next;
}
return(EXIT_FAILURE);
}