New common unarchive code.

This commit is contained in:
Glenn L McGrath
2002-09-25 02:47:48 +00:00
parent ecfa290cfd
commit 7ca04f328e
36 changed files with 2436 additions and 1914 deletions

View File

@@ -14,23 +14,19 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdlib.h>
#include "unarchive.h"
#include "libbb.h"
off_t archive_offset;
void seek_sub_file(FILE *src_stream, const int count)
extern void seek_sub_file(const int src_fd, const unsigned int amount)
{
/* Try to fseek as faster */
archive_offset += count;
if (fseek(src_stream, count, SEEK_CUR) != 0 && errno == ESPIPE) {
int i;
for (i = 0; i < count; i++) {
fgetc(src_stream);
if ((lseek(src_fd, amount, SEEK_CUR) == -1) && (errno == ESPIPE)) {
unsigned int i;
for (i = 0; i < amount; i++) {
xread_char(src_fd);
}
}
return;
}