summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/gzip.c14
-rw-r--r--archival/rpm.c43
2 files changed, 23 insertions, 34 deletions
diff --git a/archival/gzip.c b/archival/gzip.c
index 0962a00..37fefbf 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -263,15 +263,14 @@ DECLARE(ush, tab_prefix, 1L << BITS);
static int foreground; /* set if program run in foreground */
static int method = DEFLATED; /* compression method */
static int exit_code = OK; /* program exit code */
-static int part_nb; /* number of parts in .gz file */
static long time_stamp; /* original time stamp (modification time) */
-static long ifile_size; /* input file size, -1 for devices (debug only) */
static char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */
-static int z_len; /* strlen(z_suffix) */
static int ifd; /* input file descriptor */
static int ofd; /* output file descriptor */
+#ifdef DEBUG
static unsigned insize; /* valid bytes in inbuf */
+#endif
static unsigned outcnt; /* bytes in output buffer */
static uint32_t *crc_32_tab;
@@ -302,7 +301,9 @@ static void abort_gzip(int ATTRIBUTE_UNUSED ignored)
static void clear_bufs(void)
{
outcnt = 0;
+#ifdef DEBUG
insize = 0;
+#endif
bytes_in = 0L;
}
@@ -1177,7 +1178,6 @@ int gzip_main(int argc, char **argv)
#endif
strncpy(z_suffix, Z_SUFFIX, sizeof(z_suffix) - 1);
- z_len = strlen(z_suffix);
/* Allocate all global buffers (for DYN_ALLOC option) */
ALLOC(uch, inbuf, INBUFSIZ + INBUF_EXTRA);
@@ -1188,13 +1188,11 @@ int gzip_main(int argc, char **argv)
/* Initialise the CRC32 table */
crc_32_tab = crc32_filltable(0);
-
+
clear_bufs();
- part_nb = 0;
if (optind == argc) {
time_stamp = 0;
- ifile_size = -1L;
zip(STDIN_FILENO, STDOUT_FILENO);
} else {
int i;
@@ -1205,7 +1203,6 @@ int gzip_main(int argc, char **argv)
clear_bufs();
if (strcmp(argv[i], "-") == 0) {
time_stamp = 0;
- ifile_size = -1L;
inFileNum = STDIN_FILENO;
outFileNum = STDOUT_FILENO;
} else {
@@ -1213,7 +1210,6 @@ int gzip_main(int argc, char **argv)
if (fstat(inFileNum, &statBuf) < 0)
bb_perror_msg_and_die("%s", argv[i]);
time_stamp = statBuf.st_ctime;
- ifile_size = statBuf.st_size;
if (!tostdout) {
path = xmalloc(strlen(argv[i]) + 4);
diff --git a/archival/rpm.c b/archival/rpm.c
index 7b27c02..d399e0e 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -70,17 +70,15 @@ static void *map;
static rpm_index **mytags;
static int tagcount;
-void extract_cpio_gz(int fd);
-rpm_index **rpm_gettags(int fd, int *num_tags);
-int bsearch_rpmtag(const void *key, const void *item);
-char *rpm_getstring(int tag, int itemindex);
-int rpm_getint(int tag, int itemindex);
-int rpm_getcount(int tag);
-void exec_script(int progtag, int datatag, char *prefix);
-void fileaction_dobackup(char *filename, int fileref);
-void fileaction_setowngrp(char *filename, int fileref);
-void fileaction_list(char *filename, int itemno);
-void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref));
+static void extract_cpio_gz(int fd);
+static rpm_index **rpm_gettags(int fd, int *num_tags);
+static int bsearch_rpmtag(const void *key, const void *item);
+static char *rpm_getstring(int tag, int itemindex);
+static int rpm_getint(int tag, int itemindex);
+static int rpm_getcount(int tag);
+static void fileaction_dobackup(char *filename, int fileref);
+static void fileaction_setowngrp(char *filename, int fileref);
+static void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref));
int rpm_main(int argc, char **argv)
{
@@ -169,7 +167,7 @@ int rpm_main(int argc, char **argv)
return 0;
}
-void extract_cpio_gz(int fd) {
+static void extract_cpio_gz(int fd) {
archive_handle_t *archive_handle;
unsigned char magic[2];
@@ -196,7 +194,7 @@ void extract_cpio_gz(int fd) {
}
-rpm_index **rpm_gettags(int fd, int *num_tags)
+static rpm_index **rpm_gettags(int fd, int *num_tags)
{
rpm_index **tags = xzalloc(200 * sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
int pass, tagindex = 0;
@@ -235,14 +233,14 @@ rpm_index **rpm_gettags(int fd, int *num_tags)
return tags; /* All done, leave the file at the start of the gzipped cpio archive */
}
-int bsearch_rpmtag(const void *key, const void *item)
+static int bsearch_rpmtag(const void *key, const void *item)
{
int *tag = (int *)key;
rpm_index **tmp = (rpm_index **) item;
return (*tag - tmp[0]->tag);
}
-int rpm_getcount(int tag)
+static int rpm_getcount(int tag)
{
rpm_index **found;
found = bsearch(&tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
@@ -250,7 +248,7 @@ int rpm_getcount(int tag)
else return found[0]->count;
}
-char *rpm_getstring(int tag, int itemindex)
+static char *rpm_getstring(int tag, int itemindex)
{
rpm_index **found;
found = bsearch(&tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
@@ -263,7 +261,7 @@ char *rpm_getstring(int tag, int itemindex)
} else return NULL;
}
-int rpm_getint(int tag, int itemindex)
+static int rpm_getint(int tag, int itemindex)
{
rpm_index **found;
int n, *tmpint;
@@ -284,7 +282,7 @@ int rpm_getint(int tag, int itemindex)
} else return -1;
}
-void fileaction_dobackup(char *filename, int fileref)
+static void fileaction_dobackup(char *filename, int fileref)
{
struct stat oldfile;
int stat_res;
@@ -301,7 +299,7 @@ void fileaction_dobackup(char *filename, int fileref)
}
}
-void fileaction_setowngrp(char *filename, int fileref)
+static void fileaction_setowngrp(char *filename, int fileref)
{
int uid, gid;
uid = bb_xgetpwnam(rpm_getstring(RPMTAG_FILEUSERNAME, fileref));
@@ -309,12 +307,7 @@ void fileaction_setowngrp(char *filename, int fileref)
chown (filename, uid, gid);
}
-void fileaction_list(char *filename, int ATTRIBUTE_UNUSED fileref)
-{
- printf("%s\n", filename);
-}
-
-void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref))
+static void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref))
{
int count = 0;
while (rpm_getstring(filetag, count)) {