New common unarchive code.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user