mirror of
https://github.com/sheumann/hush.git
synced 2024-12-25 18:33:06 +00:00
Move unzip, gz_open, gz_close to libbb
This commit is contained in:
parent
d22e560ad6
commit
7fd92949d0
14
Makefile
14
Makefile
@ -240,13 +240,13 @@ concat_path_file.c copy_file.c copy_file_chunk.c create_path.c daemon.c \
|
||||
deb_extract.c device_open.c error_msg.c error_msg_and_die.c \
|
||||
find_mount_point.c find_pid_by_name.c find_root_device.c full_read.c \
|
||||
full_write.c get_ar_headers.c get_console.c get_last_path_component.c \
|
||||
get_line_from_file.c human_readable.c inode_hash.c isdirectory.c \
|
||||
kernel_version.c loop.c mode_string.c module_syscalls.c mtab.c mtab_file.c \
|
||||
my_getgrnam.c my_getgrgid.c my_getpwnam.c my_getpwnamegid.c my_getpwuid.c \
|
||||
parse_mode.c parse_number.c perror_msg.c perror_msg_and_die.c print_file.c \
|
||||
process_escape_sequence.c recursive_action.c safe_read.c safe_strncpy.c \
|
||||
syscalls.c syslog_msg_with_name.c time_string.c trim.c vdprintf.c verror_msg.c \
|
||||
vperror_msg.c wfopen.c xfuncs.c xgetcwd.c xregcomp.c
|
||||
get_line_from_file.c gz_open.c human_readable.c inode_hash.c \
|
||||
isdirectory.c kernel_version.c loop.c mode_string.c module_syscalls.c mtab.c \
|
||||
mtab_file.c my_getgrnam.c my_getgrgid.c my_getpwnam.c my_getpwnamegid.c \
|
||||
my_getpwuid.c parse_mode.c parse_number.c perror_msg.c perror_msg_and_die.c \
|
||||
print_file.c process_escape_sequence.c recursive_action.c safe_read.c \
|
||||
safe_strncpy.c syscalls.c syslog_msg_with_name.c time_string.c trim.c unzip.c \
|
||||
vdprintf.c verror_msg.c vperror_msg.c wfopen.c xfuncs.c xgetcwd.c xregcomp.c
|
||||
|
||||
LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC))
|
||||
LIBBB_CFLAGS = -I$(LIBBB)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -278,7 +278,6 @@ extern int zip (int in, int out);
|
||||
extern int file_read (char *buf, unsigned size);
|
||||
|
||||
/* in unzip.c */
|
||||
extern int unzip (int in, int out);
|
||||
extern int check_zipfile (int in);
|
||||
|
||||
/* in unpack.c */
|
||||
|
1025
archival/libunarchive/decompress_unzip.c
Normal file
1025
archival/libunarchive/decompress_unzip.c
Normal file
File diff suppressed because it is too large
Load Diff
1025
archival/libunarchive/unzip.c
Normal file
1025
archival/libunarchive/unzip.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -56,12 +56,6 @@
|
||||
#define bb_need_name_longer_than_foo
|
||||
#include "messages.c"
|
||||
|
||||
#ifdef BB_FEATURE_TAR_GZIP
|
||||
extern int unzip(int in, int out);
|
||||
extern int gz_open(FILE *compressed_file, int *pid);
|
||||
extern void gz_close(int gunzip_pid);
|
||||
#endif
|
||||
|
||||
/* Tar file constants */
|
||||
#ifndef MAJOR
|
||||
#define MAJOR(dev) (((dev)>>8)&0xff)
|
||||
|
1
gzip.c
1
gzip.c
@ -278,7 +278,6 @@ extern int zip (int in, int out);
|
||||
extern int file_read (char *buf, unsigned size);
|
||||
|
||||
/* in unzip.c */
|
||||
extern int unzip (int in, int out);
|
||||
extern int check_zipfile (int in);
|
||||
|
||||
/* in unpack.c */
|
||||
|
@ -227,4 +227,8 @@ typedef struct ar_headers_s {
|
||||
} ar_headers_t;
|
||||
extern ar_headers_t get_ar_headers(int srcFd);
|
||||
extern int deb_extract(int optflags, const char *dir_name, const char *deb_filename);
|
||||
|
||||
extern int unzip(FILE *l_in_file, FILE *l_out_file);
|
||||
extern void gz_close(int gunzip_pid);
|
||||
extern int gz_open(FILE *compressed_file, int *pid);
|
||||
#endif /* __LIBBB_H__ */
|
||||
|
34
libbb/gz_open.c
Normal file
34
libbb/gz_open.c
Normal file
@ -0,0 +1,34 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "libbb.h"
|
||||
|
||||
extern int gz_open(FILE *compressed_file, int *pid)
|
||||
{
|
||||
int unzip_pipe[2];
|
||||
|
||||
if (pipe(unzip_pipe)!=0) {
|
||||
error_msg("pipe error");
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
if ((*pid = fork()) == -1) {
|
||||
error_msg("fork failured");
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
if (*pid==0) {
|
||||
/* child process */
|
||||
close(unzip_pipe[0]);
|
||||
unzip(compressed_file, fdopen(unzip_pipe[1], "w"));
|
||||
printf("finished unzipping\n");
|
||||
fflush(NULL);
|
||||
fclose(compressed_file);
|
||||
close(unzip_pipe[1]);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
close(unzip_pipe[1]);
|
||||
return(unzip_pipe[0]);
|
||||
}
|
@ -227,4 +227,8 @@ typedef struct ar_headers_s {
|
||||
} ar_headers_t;
|
||||
extern ar_headers_t get_ar_headers(int srcFd);
|
||||
extern int deb_extract(int optflags, const char *dir_name, const char *deb_filename);
|
||||
|
||||
extern int unzip(FILE *l_in_file, FILE *l_out_file);
|
||||
extern void gz_close(int gunzip_pid);
|
||||
extern int gz_open(FILE *compressed_file, int *pid);
|
||||
#endif /* __LIBBB_H__ */
|
||||
|
1025
libbb/unzip.c
Normal file
1025
libbb/unzip.c
Normal file
File diff suppressed because it is too large
Load Diff
6
tar.c
6
tar.c
@ -56,12 +56,6 @@
|
||||
#define bb_need_name_longer_than_foo
|
||||
#include "messages.c"
|
||||
|
||||
#ifdef BB_FEATURE_TAR_GZIP
|
||||
extern int unzip(int in, int out);
|
||||
extern int gz_open(FILE *compressed_file, int *pid);
|
||||
extern void gz_close(int gunzip_pid);
|
||||
#endif
|
||||
|
||||
/* Tar file constants */
|
||||
#ifndef MAJOR
|
||||
#define MAJOR(dev) (((dev)>>8)&0xff)
|
||||
|
Loading…
Reference in New Issue
Block a user