summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2005-04-16 19:39:00 +0000
committerEric Andersen <andersen@codepoet.org>2005-04-16 19:39:00 +0000
commit14f5c8d764ab7429367feb407ab86191054e6a8a (patch)
tree2aa792b8a9d8f7af365c456f19f34a963236c26d /archival
parenta77b4f39708306d44058d7ca1683f448f51c5fce (diff)
downloadbusybox-w32-14f5c8d764ab7429367feb407ab86191054e6a8a.tar.gz
busybox-w32-14f5c8d764ab7429367feb407ab86191054e6a8a.tar.bz2
busybox-w32-14f5c8d764ab7429367feb407ab86191054e6a8a.zip
Patch from Bernhard Fischer to make a bunch of symbols static
which were otherwise cluttering the global namespace.
Diffstat (limited to 'archival')
-rw-r--r--archival/dpkg.c64
-rw-r--r--archival/libunarchive/check_header_gzip.c1
-rw-r--r--archival/libunarchive/decompress_uncompress.c14
-rw-r--r--archival/rpm2cpio.c2
4 files changed, 41 insertions, 40 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c
index d3b56e398..05ba43414 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -58,7 +58,7 @@
58 * I estimate it should be at least 50% bigger than PACKAGE_HASH_PRIME, 58 * I estimate it should be at least 50% bigger than PACKAGE_HASH_PRIME,
59 * as there a lot of duplicate version numbers */ 59 * as there a lot of duplicate version numbers */
60#define NAME_HASH_PRIME 16381 60#define NAME_HASH_PRIME 16381
61char *name_hashtable[NAME_HASH_PRIME + 1]; 61static char *name_hashtable[NAME_HASH_PRIME + 1];
62 62
63/* PACKAGE_HASH_PRIME, Maximum number of unique packages, 63/* PACKAGE_HASH_PRIME, Maximum number of unique packages,
64 * It must not be smaller than STATUS_HASH_PRIME, 64 * It must not be smaller than STATUS_HASH_PRIME,
@@ -82,7 +82,7 @@ typedef struct common_node_s {
82 unsigned int num_of_edges:14; 82 unsigned int num_of_edges:14;
83 edge_t **edge; 83 edge_t **edge;
84} common_node_t; 84} common_node_t;
85common_node_t *package_hashtable[PACKAGE_HASH_PRIME + 1]; 85static common_node_t *package_hashtable[PACKAGE_HASH_PRIME + 1];
86 86
87/* Currently it doesnt store packages that have state-status of not-installed 87/* Currently it doesnt store packages that have state-status of not-installed
88 * So it only really has to be the size of the maximum number of packages 88 * So it only really has to be the size of the maximum number of packages
@@ -92,7 +92,7 @@ typedef struct status_node_s {
92 unsigned int package:14; /* has to fit PACKAGE_HASH_PRIME */ 92 unsigned int package:14; /* has to fit PACKAGE_HASH_PRIME */
93 unsigned int status:14; /* has to fit STATUS_HASH_PRIME */ 93 unsigned int status:14; /* has to fit STATUS_HASH_PRIME */
94} status_node_t; 94} status_node_t;
95status_node_t *status_hashtable[STATUS_HASH_PRIME + 1]; 95static status_node_t *status_hashtable[STATUS_HASH_PRIME + 1];
96 96
97/* Even numbers are for 'extras', like ored dependencies or null */ 97/* Even numbers are for 'extras', like ored dependencies or null */
98enum edge_type_e { 98enum edge_type_e {
@@ -137,7 +137,7 @@ typedef struct deb_file_s {
137} deb_file_t; 137} deb_file_t;
138 138
139 139
140void make_hash(const char *key, unsigned int *start, unsigned int *decrement, const int hash_prime) 140static void make_hash(const char *key, unsigned int *start, unsigned int *decrement, const int hash_prime)
141{ 141{
142 unsigned long int hash_num = key[0]; 142 unsigned long int hash_num = key[0];
143 int len = strlen(key); 143 int len = strlen(key);
@@ -157,7 +157,7 @@ void make_hash(const char *key, unsigned int *start, unsigned int *decrement, co
157} 157}
158 158
159/* this adds the key to the hash table */ 159/* this adds the key to the hash table */
160int search_name_hashtable(const char *key) 160static int search_name_hashtable(const char *key)
161{ 161{
162 unsigned int probe_address = 0; 162 unsigned int probe_address = 0;
163 unsigned int probe_decrement = 0; 163 unsigned int probe_decrement = 0;
@@ -181,7 +181,7 @@ int search_name_hashtable(const char *key)
181/* this DOESNT add the key to the hashtable 181/* this DOESNT add the key to the hashtable
182 * TODO make it consistent with search_name_hashtable 182 * TODO make it consistent with search_name_hashtable
183 */ 183 */
184unsigned int search_status_hashtable(const char *key) 184static unsigned int search_status_hashtable(const char *key)
185{ 185{
186 unsigned int probe_address = 0; 186 unsigned int probe_address = 0;
187 unsigned int probe_decrement = 0; 187 unsigned int probe_decrement = 0;
@@ -201,7 +201,7 @@ unsigned int search_status_hashtable(const char *key)
201} 201}
202 202
203/* Need to rethink version comparison, maybe the official dpkg has something i can use ? */ 203/* Need to rethink version comparison, maybe the official dpkg has something i can use ? */
204int version_compare_part(const char *version1, const char *version2) 204static int version_compare_part(const char *version1, const char *version2)
205{ 205{
206 int upstream_len1 = 0; 206 int upstream_len1 = 0;
207 int upstream_len2 = 0; 207 int upstream_len2 = 0;
@@ -268,7 +268,7 @@ cleanup_version_compare_part:
268 * if ver1 = ver2 return 0, 268 * if ver1 = ver2 return 0,
269 * if ver1 > ver2 return 1, 269 * if ver1 > ver2 return 1,
270 */ 270 */
271int version_compare(const unsigned int ver1, const unsigned int ver2) 271static int version_compare(const unsigned int ver1, const unsigned int ver2)
272{ 272{
273 char *ch_ver1 = name_hashtable[ver1]; 273 char *ch_ver1 = name_hashtable[ver1];
274 char *ch_ver2 = name_hashtable[ver2]; 274 char *ch_ver2 = name_hashtable[ver2];
@@ -330,7 +330,7 @@ int version_compare(const unsigned int ver1, const unsigned int ver2)
330 return(version_compare_part(deb_ver1, deb_ver2)); 330 return(version_compare_part(deb_ver1, deb_ver2));
331} 331}
332 332
333int test_version(const unsigned int version1, const unsigned int version2, const unsigned int operator) 333static int test_version(const unsigned int version1, const unsigned int version2, const unsigned int operator)
334{ 334{
335 const int version_result = version_compare(version1, version2); 335 const int version_result = version_compare(version1, version2);
336 switch(operator) { 336 switch(operator) {
@@ -366,7 +366,7 @@ int test_version(const unsigned int version1, const unsigned int version2, const
366} 366}
367 367
368 368
369int search_package_hashtable(const unsigned int name, const unsigned int version, const unsigned int operator) 369static int search_package_hashtable(const unsigned int name, const unsigned int version, const unsigned int operator)
370{ 370{
371 unsigned int probe_address = 0; 371 unsigned int probe_address = 0;
372 unsigned int probe_decrement = 0; 372 unsigned int probe_decrement = 0;
@@ -405,7 +405,7 @@ int search_package_hashtable(const unsigned int name, const unsigned int version
405 * FIXME: I don't think this is very efficient, but I thought I'd keep 405 * FIXME: I don't think this is very efficient, but I thought I'd keep
406 * it simple for now until it proves to be a problem. 406 * it simple for now until it proves to be a problem.
407 */ 407 */
408int search_for_provides(int needle, int start_at) { 408static int search_for_provides(int needle, int start_at) {
409 int i, j; 409 int i, j;
410 common_node_t *p; 410 common_node_t *p;
411 for (i = start_at + 1; i < PACKAGE_HASH_PRIME; i++) { 411 for (i = start_at + 1; i < PACKAGE_HASH_PRIME; i++) {
@@ -421,7 +421,7 @@ int search_for_provides(int needle, int start_at) {
421/* 421/*
422 * Add an edge to a node 422 * Add an edge to a node
423 */ 423 */
424void add_edge_to_node(common_node_t *node, edge_t *edge) 424static void add_edge_to_node(common_node_t *node, edge_t *edge)
425{ 425{
426 node->num_of_edges++; 426 node->num_of_edges++;
427 node->edge = xrealloc(node->edge, sizeof(edge_t) * (node->num_of_edges + 1)); 427 node->edge = xrealloc(node->edge, sizeof(edge_t) * (node->num_of_edges + 1));
@@ -438,7 +438,7 @@ void add_edge_to_node(common_node_t *node, edge_t *edge)
438 * field contains the number of EDGE nodes which follow as part of 438 * field contains the number of EDGE nodes which follow as part of
439 * this alternative. 439 * this alternative.
440 */ 440 */
441void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned int edge_type) 441static void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned int edge_type)
442{ 442{
443 char *line = bb_xstrdup(whole_line); 443 char *line = bb_xstrdup(whole_line);
444 char *line2; 444 char *line2;
@@ -537,7 +537,7 @@ void add_split_dependencies(common_node_t *parent_node, const char *whole_line,
537 return; 537 return;
538} 538}
539 539
540void free_package(common_node_t *node) 540static void free_package(common_node_t *node)
541{ 541{
542 unsigned short i; 542 unsigned short i;
543 if (node) { 543 if (node) {
@@ -550,7 +550,7 @@ void free_package(common_node_t *node)
550 } 550 }
551} 551}
552 552
553unsigned int fill_package_struct(char *control_buffer) 553static unsigned int fill_package_struct(char *control_buffer)
554{ 554{
555 common_node_t *new_node = (common_node_t *) xcalloc(1, sizeof(common_node_t)); 555 common_node_t *new_node = (common_node_t *) xcalloc(1, sizeof(common_node_t));
556 const char *field_names[] = { "Package", "Version", "Pre-Depends", "Depends", 556 const char *field_names[] = { "Package", "Version", "Pre-Depends", "Depends",
@@ -624,7 +624,7 @@ fill_package_struct_cleanup:
624} 624}
625 625
626/* if num = 1, it returns the want status, 2 returns flag, 3 returns status */ 626/* if num = 1, it returns the want status, 2 returns flag, 3 returns status */
627unsigned int get_status(const unsigned int status_node, const int num) 627static unsigned int get_status(const unsigned int status_node, const int num)
628{ 628{
629 char *status_string = name_hashtable[status_hashtable[status_node]->status]; 629 char *status_string = name_hashtable[status_hashtable[status_node]->status];
630 char *state_sub_string; 630 char *state_sub_string;
@@ -646,7 +646,7 @@ unsigned int get_status(const unsigned int status_node, const int num)
646 return(state_sub_num); 646 return(state_sub_num);
647} 647}
648 648
649void set_status(const unsigned int status_node_num, const char *new_value, const int position) 649static void set_status(const unsigned int status_node_num, const char *new_value, const int position)
650{ 650{
651 const unsigned int new_value_len = strlen(new_value); 651 const unsigned int new_value_len = strlen(new_value);
652 const unsigned int new_value_num = search_name_hashtable(new_value); 652 const unsigned int new_value_num = search_name_hashtable(new_value);
@@ -682,7 +682,7 @@ void set_status(const unsigned int status_node_num, const char *new_value, const
682 return; 682 return;
683} 683}
684 684
685const char *describe_status(int status_num) { 685static const char *describe_status(int status_num) {
686 int status_want, status_state ; 686 int status_want, status_state ;
687 if ( status_hashtable[status_num] == NULL || status_hashtable[status_num]->status == 0 ) 687 if ( status_hashtable[status_num] == NULL || status_hashtable[status_num]->status == 0 )
688 return "is not installed or flagged to be installed\n"; 688 return "is not installed or flagged to be installed\n";
@@ -707,7 +707,7 @@ const char *describe_status(int status_num) {
707} 707}
708 708
709 709
710void index_status_file(const char *filename) 710static void index_status_file(const char *filename)
711{ 711{
712 FILE *status_file; 712 FILE *status_file;
713 char *control_buffer; 713 char *control_buffer;
@@ -812,7 +812,7 @@ char *get_depends_field(common_node_t *package, const int depends_type)
812} 812}
813#endif 813#endif
814 814
815void write_buffer_no_status(FILE *new_status_file, const char *control_buffer) 815static void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
816{ 816{
817 char *name; 817 char *name;
818 char *value; 818 char *value;
@@ -830,7 +830,7 @@ void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
830} 830}
831 831
832/* This could do with a cleanup */ 832/* This could do with a cleanup */
833void write_status_file(deb_file_t **deb_file) 833static void write_status_file(deb_file_t **deb_file)
834{ 834{
835 FILE *old_status_file = bb_xfopen("/var/lib/dpkg/status", "r"); 835 FILE *old_status_file = bb_xfopen("/var/lib/dpkg/status", "r");
836 FILE *new_status_file = bb_xfopen("/var/lib/dpkg/status.udeb", "w"); 836 FILE *new_status_file = bb_xfopen("/var/lib/dpkg/status.udeb", "w");
@@ -978,7 +978,7 @@ void write_status_file(deb_file_t **deb_file)
978 * which a regular depends can be satisfied by a package which we want 978 * which a regular depends can be satisfied by a package which we want
979 * to install. 979 * to install.
980 */ 980 */
981int package_satisfies_dependency(int package, int depend_type) 981static int package_satisfies_dependency(int package, int depend_type)
982{ 982{
983 int status_num = search_status_hashtable(name_hashtable[package_hashtable[package]->name]); 983 int status_num = search_status_hashtable(name_hashtable[package_hashtable[package]->name]);
984 984
@@ -995,7 +995,7 @@ int package_satisfies_dependency(int package, int depend_type)
995 return 0; 995 return 0;
996} 996}
997 997
998int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) 998static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
999{ 999{
1000 int *conflicts = NULL; 1000 int *conflicts = NULL;
1001 int conflicts_num = 0; 1001 int conflicts_num = 0;
@@ -1204,7 +1204,7 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
1204 return(TRUE); 1204 return(TRUE);
1205} 1205}
1206 1206
1207char **create_list(const char *filename) 1207static char **create_list(const char *filename)
1208{ 1208{
1209 FILE *list_stream; 1209 FILE *list_stream;
1210 char **file_list = NULL; 1210 char **file_list = NULL;
@@ -1233,7 +1233,7 @@ char **create_list(const char *filename)
1233} 1233}
1234 1234
1235/* maybe i should try and hook this into remove_file.c somehow */ 1235/* maybe i should try and hook this into remove_file.c somehow */
1236int remove_file_array(char **remove_names, char **exclude_names) 1236static int remove_file_array(char **remove_names, char **exclude_names)
1237{ 1237{
1238 struct stat path_stat; 1238 struct stat path_stat;
1239 int match_flag; 1239 int match_flag;
@@ -1271,7 +1271,7 @@ int remove_file_array(char **remove_names, char **exclude_names)
1271 return(remove_flag); 1271 return(remove_flag);
1272} 1272}
1273 1273
1274int run_package_script(const char *package_name, const char *script_type) 1274static int run_package_script(const char *package_name, const char *script_type)
1275{ 1275{
1276 struct stat path_stat; 1276 struct stat path_stat;
1277 char *script_path; 1277 char *script_path;
@@ -1290,10 +1290,10 @@ int run_package_script(const char *package_name, const char *script_type)
1290 return(result); 1290 return(result);
1291} 1291}
1292 1292
1293const char *all_control_files[] = {"preinst", "postinst", "prerm", "postrm", 1293static const char *all_control_files[] = {"preinst", "postinst", "prerm", "postrm",
1294 "list", "md5sums", "shlibs", "conffiles", "config", "templates", NULL }; 1294 "list", "md5sums", "shlibs", "conffiles", "config", "templates", NULL };
1295 1295
1296char **all_control_list(const char *package_name) 1296static char **all_control_list(const char *package_name)
1297{ 1297{
1298 unsigned short i = 0; 1298 unsigned short i = 0;
1299 char **remove_files; 1299 char **remove_files;
@@ -1310,7 +1310,7 @@ char **all_control_list(const char *package_name)
1310 return(remove_files); 1310 return(remove_files);
1311} 1311}
1312 1312
1313void free_array(char **array) 1313static void free_array(char **array)
1314{ 1314{
1315 1315
1316 if (array) { 1316 if (array) {
@@ -1364,7 +1364,7 @@ static void list_packages(void)
1364 } 1364 }
1365} 1365}
1366 1366
1367void remove_package(const unsigned int package_num, int noisy) 1367static void remove_package(const unsigned int package_num, int noisy)
1368{ 1368{
1369 const char *package_name = name_hashtable[package_hashtable[package_num]->name]; 1369 const char *package_name = name_hashtable[package_hashtable[package_num]->name];
1370 const char *package_version = name_hashtable[package_hashtable[package_num]->version]; 1370 const char *package_version = name_hashtable[package_hashtable[package_num]->version];
@@ -1418,7 +1418,7 @@ void remove_package(const unsigned int package_num, int noisy)
1418 set_status(status_num, "config-files", 3); 1418 set_status(status_num, "config-files", 3);
1419} 1419}
1420 1420
1421void purge_package(const unsigned int package_num) 1421static void purge_package(const unsigned int package_num)
1422{ 1422{
1423 const char *package_name = name_hashtable[package_hashtable[package_num]->name]; 1423 const char *package_name = name_hashtable[package_hashtable[package_num]->name];
1424 const char *package_version = name_hashtable[package_hashtable[package_num]->version]; 1424 const char *package_version = name_hashtable[package_hashtable[package_num]->version];
@@ -1614,7 +1614,7 @@ static void unpack_package(deb_file_t *deb_file)
1614 free(info_prefix); 1614 free(info_prefix);
1615} 1615}
1616 1616
1617void configure_package(deb_file_t *deb_file) 1617static void configure_package(deb_file_t *deb_file)
1618{ 1618{
1619 const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name]; 1619 const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name];
1620 const char *package_version = name_hashtable[package_hashtable[deb_file->package]->version]; 1620 const char *package_version = name_hashtable[package_hashtable[deb_file->package]->version];
diff --git a/archival/libunarchive/check_header_gzip.c b/archival/libunarchive/check_header_gzip.c
index 13832c240..9e065c4fd 100644
--- a/archival/libunarchive/check_header_gzip.c
+++ b/archival/libunarchive/check_header_gzip.c
@@ -1,6 +1,7 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <unistd.h> 2#include <unistd.h>
3#include "libbb.h" 3#include "libbb.h"
4#include "unarchive.h" /* for external decl of check_header_gzip */
4 5
5extern void check_header_gzip(int src_fd) 6extern void check_header_gzip(int src_fd)
6{ 7{
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c
index e39872cbe..a3fcf64e2 100644
--- a/archival/libunarchive/decompress_uncompress.c
+++ b/archival/libunarchive/decompress_uncompress.c
@@ -65,23 +65,23 @@
65#define MAXCODE(n) (1L << (n)) 65#define MAXCODE(n) (1L << (n))
66 66
67/* Block compress mode -C compatible with 2.0 */ 67/* Block compress mode -C compatible with 2.0 */
68int block_mode = BLOCK_MODE; 68static int block_mode = BLOCK_MODE;
69 69
70/* user settable max # bits/code */ 70/* user settable max # bits/code */
71int maxbits = BITS; 71static int maxbits = BITS;
72 72
73/* Exitcode of compress (-1 no file compressed) */ 73/* Exitcode of compress (-1 no file compressed) */
74int exit_code = -1; 74static int exit_code = -1;
75 75
76/* Input buffer */ 76/* Input buffer */
77unsigned char inbuf[IBUFSIZ + 64]; 77static unsigned char inbuf[IBUFSIZ + 64];
78 78
79/* Output buffer */ 79/* Output buffer */
80unsigned char outbuf[OBUFSIZ + 2048]; 80static unsigned char outbuf[OBUFSIZ + 2048];
81 81
82 82
83long int htab[HSIZE]; 83static long int htab[HSIZE];
84unsigned short codetab[HSIZE]; 84static unsigned short codetab[HSIZE];
85 85
86#define htabof(i) htab[i] 86#define htabof(i) htab[i]
87#define codetabof(i) codetab[i] 87#define codetabof(i) codetab[i]
diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c
index 5314e5300..8316d2242 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -48,7 +48,7 @@ struct rpm_header {
48 uint32_t size; /* Size of store (4 bytes) */ 48 uint32_t size; /* Size of store (4 bytes) */
49}; 49};
50 50
51void skip_header(int rpm_fd) 51static void skip_header(int rpm_fd)
52{ 52{
53 struct rpm_header header; 53 struct rpm_header header;
54 54