aboutsummaryrefslogtreecommitdiff
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
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.
-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
-rw-r--r--coreutils/md5_sha1_sum.c2
-rw-r--r--coreutils/sort.c6
-rw-r--r--editors/sed.c24
-rw-r--r--findutils/find.c2
-rw-r--r--libbb/hash_fd.c2
-rw-r--r--libbb/interface.c2
-rw-r--r--loginutils/getty.c4
-rw-r--r--loginutils/login.c2
-rw-r--r--loginutils/passwd.c4
-rw-r--r--loginutils/vlock.c2
-rw-r--r--miscutils/hdparm.c4
-rw-r--r--modutils/modprobe.c2
-rw-r--r--networking/arping.c6
-rw-r--r--networking/ifupdown.c4
-rw-r--r--networking/libiproute/ipaddress.c2
-rw-r--r--networking/libiproute/iptunnel.c4
-rw-r--r--networking/libiproute/ll_proto.c2
-rw-r--r--networking/libiproute/ll_types.c2
-rw-r--r--networking/libiproute/rt_names.c10
-rw-r--r--networking/nameif.c2
-rw-r--r--networking/ping.c5
-rw-r--r--networking/route.c1
-rw-r--r--networking/tftp.c4
-rw-r--r--networking/udhcp/script.h2
-rw-r--r--networking/wget.c4
-rw-r--r--procps/top.c2
30 files changed, 96 insertions, 91 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
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index bd1c9fc29..189a90778 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -80,7 +80,7 @@ static uint8_t *hash_file(const char *filename, uint8_t hash_algo)
80} 80}
81 81
82/* This could become a common function for md5 as well, by using md5_stream */ 82/* This could become a common function for md5 as well, by using md5_stream */
83extern int hash_files(int argc, char **argv, const uint8_t hash_algo) 83static int hash_files(int argc, char **argv, const uint8_t hash_algo)
84{ 84{
85 int return_value = EXIT_SUCCESS; 85 int return_value = EXIT_SUCCESS;
86 uint8_t *hash_value; 86 uint8_t *hash_value;
diff --git a/coreutils/sort.c b/coreutils/sort.c
index c701b5e4f..73505e365 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -31,7 +31,7 @@
31#include <unistd.h> 31#include <unistd.h>
32#include "busybox.h" 32#include "busybox.h"
33 33
34int global_flags; 34static int global_flags;
35 35
36/* 36/*
37 sort [-m][-o output][-bdfinru][-t char][-k keydef]... [file...] 37 sort [-m][-o output][-bdfinru][-t char][-k keydef]... [file...]
@@ -57,9 +57,9 @@ int global_flags;
57 57
58 58
59#ifdef CONFIG_SORT_BIG 59#ifdef CONFIG_SORT_BIG
60char key_separator; 60static char key_separator;
61 61
62struct sort_key 62static struct sort_key
63{ 63{
64 struct sort_key *next_key; /* linked list */ 64 struct sort_key *next_key; /* linked list */
65 unsigned short range[4]; /* start word, start char, end word, end char */ 65 unsigned short range[4]; /* start word, start char, end word, end char */
diff --git a/editors/sed.c b/editors/sed.c
index db364e3ee..7950b9303 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -116,18 +116,18 @@ typedef struct sed_cmd_s {
116/* globals */ 116/* globals */
117/* options */ 117/* options */
118static int be_quiet, in_place, regex_type; 118static int be_quiet, in_place, regex_type;
119FILE *nonstdout; 119static FILE *nonstdout;
120char *outname,*hold_space; 120static char *outname,*hold_space;
121 121
122/* List of input files */ 122/* List of input files */
123int input_file_count,current_input_file; 123static int input_file_count,current_input_file;
124FILE **input_file_list; 124static FILE **input_file_list;
125 125
126static const char bad_format_in_subst[] = 126static const char bad_format_in_subst[] =
127 "bad format in substitution expression"; 127 "bad format in substitution expression";
128const char *const semicolon_whitespace = "; \n\r\t\v"; 128static const char *const semicolon_whitespace = "; \n\r\t\v";
129 129
130regmatch_t regmatch[10]; 130static regmatch_t regmatch[10];
131static regex_t *previous_regex_ptr; 131static regex_t *previous_regex_ptr;
132 132
133/* linked list of sed commands */ 133/* linked list of sed commands */
@@ -135,11 +135,11 @@ static sed_cmd_t sed_cmd_head;
135static sed_cmd_t *sed_cmd_tail = &sed_cmd_head; 135static sed_cmd_t *sed_cmd_tail = &sed_cmd_head;
136 136
137/* Linked list of append lines */ 137/* Linked list of append lines */
138struct append_list { 138static struct append_list {
139 char *string; 139 char *string;
140 struct append_list *next; 140 struct append_list *next;
141}; 141};
142struct append_list *append_head=NULL, *append_tail=NULL; 142static struct append_list *append_head=NULL, *append_tail=NULL;
143 143
144#ifdef CONFIG_FEATURE_CLEAN_UP 144#ifdef CONFIG_FEATURE_CLEAN_UP
145static void free_and_close_stuff(void) 145static void free_and_close_stuff(void)
@@ -482,7 +482,7 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr)
482 482
483/* Parse address+command sets, skipping comment lines. */ 483/* Parse address+command sets, skipping comment lines. */
484 484
485void add_cmd(char *cmdstr) 485static void add_cmd(char *cmdstr)
486{ 486{
487 static char *add_cmd_line=NULL; 487 static char *add_cmd_line=NULL;
488 sed_cmd_t *sed_cmd; 488 sed_cmd_t *sed_cmd;
@@ -576,7 +576,7 @@ void add_cmd(char *cmdstr)
576 576
577/* Append to a string, reallocating memory as necessary. */ 577/* Append to a string, reallocating memory as necessary. */
578 578
579struct pipeline { 579static struct pipeline {
580 char *buf; /* Space to hold string */ 580 char *buf; /* Space to hold string */
581 int idx; /* Space used */ 581 int idx; /* Space used */
582 int len; /* Space allocated */ 582 int len; /* Space allocated */
@@ -584,7 +584,7 @@ struct pipeline {
584 584
585#define PIPE_GROW 64 585#define PIPE_GROW 64
586 586
587void pipe_putc(char c) 587static void pipe_putc(char c)
588{ 588{
589 if(pipeline.idx==pipeline.len) { 589 if(pipeline.idx==pipeline.len) {
590 pipeline.buf = xrealloc(pipeline.buf, pipeline.len + PIPE_GROW); 590 pipeline.buf = xrealloc(pipeline.buf, pipeline.len + PIPE_GROW);
@@ -729,7 +729,7 @@ static void flush_append(void)
729 append_head=append_tail=NULL; 729 append_head=append_tail=NULL;
730} 730}
731 731
732void add_input_file(FILE *file) 732static void add_input_file(FILE *file)
733{ 733{
734 input_file_list=xrealloc(input_file_list,(input_file_count+1)*sizeof(FILE *)); 734 input_file_list=xrealloc(input_file_list,(input_file_count+1)*sizeof(FILE *));
735 input_file_list[input_file_count++]=file; 735 input_file_list[input_file_count++]=file;
diff --git a/findutils/find.c b/findutils/find.c
index 11a838e9f..abbd82b3a 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -59,7 +59,7 @@ static int xdev_count = 0;
59#endif 59#endif
60 60
61#ifdef CONFIG_FEATURE_FIND_NEWER 61#ifdef CONFIG_FEATURE_FIND_NEWER
62time_t newer_mtime; 62static time_t newer_mtime;
63#endif 63#endif
64 64
65#ifdef CONFIG_FEATURE_FIND_INUM 65#ifdef CONFIG_FEATURE_FIND_INUM
diff --git a/libbb/hash_fd.c b/libbb/hash_fd.c
index e37ac549a..5f12259b3 100644
--- a/libbb/hash_fd.c
+++ b/libbb/hash_fd.c
@@ -197,7 +197,7 @@ static uint32_t mask[4] = { 0x00000000, 0xff000000, 0xffff0000, 0xffffff00 };
197static uint32_t bits[4] = { 0x80000000, 0x00800000, 0x00008000, 0x00000080 }; 197static uint32_t bits[4] = { 0x80000000, 0x00800000, 0x00008000, 0x00000080 };
198# endif /* __BYTE_ORDER */ 198# endif /* __BYTE_ORDER */
199 199
200void sha1_end(unsigned char hval[], struct sha1_ctx_t *ctx) 200static void sha1_end(unsigned char hval[], struct sha1_ctx_t *ctx)
201{ 201{
202 uint32_t i, cnt = (uint32_t) (ctx->count[0] & SHA1_MASK); 202 uint32_t i, cnt = (uint32_t) (ctx->count[0] & SHA1_MASK);
203 203
diff --git a/libbb/interface.c b/libbb/interface.c
index db18b9ad9..37a5f6405 100644
--- a/libbb/interface.c
+++ b/libbb/interface.c
@@ -986,7 +986,7 @@ static int if_readconf(void)
986 return err; 986 return err;
987} 987}
988 988
989char *get_name(char *name, char *p) 989static char *get_name(char *name, char *p)
990{ 990{
991 /* Extract <name>[:<alias>] from nul-terminated p where p matches 991 /* Extract <name>[:<alias>] from nul-terminated p where p matches
992 <name>[:<alias>]: after leading whitespace. 992 <name>[:<alias>]: after leading whitespace.
diff --git a/loginutils/getty.c b/loginutils/getty.c
index a9ef561fa..3dd6258c5 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -151,7 +151,7 @@ struct options {
151 151
152/* Storage for things detected while the login name was read. */ 152/* Storage for things detected while the login name was read. */
153 153
154struct chardata { 154static struct chardata {
155 int erase; /* erase character */ 155 int erase; /* erase character */
156 int kill; /* kill character */ 156 int kill; /* kill character */
157 int eol; /* end-of-line character */ 157 int eol; /* end-of-line character */
@@ -161,7 +161,7 @@ struct chardata {
161 161
162/* Initial values for the above. */ 162/* Initial values for the above. */
163 163
164struct chardata init_chardata = { 164static struct chardata init_chardata = {
165 DEF_ERASE, /* default erase character */ 165 DEF_ERASE, /* default erase character */
166 DEF_KILL, /* default kill character */ 166 DEF_KILL, /* default kill character */
167 13, /* default eol char */ 167 13, /* default eol char */
diff --git a/loginutils/login.c b/loginutils/login.c
index 25f3c01e2..34095a6a7 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -28,7 +28,7 @@
28static void checkutmp(int picky); 28static void checkutmp(int picky);
29static void setutmp(const char *name, const char *line); 29static void setutmp(const char *name, const char *line);
30/* Stuff global to this file */ 30/* Stuff global to this file */
31struct utmp utent; 31static struct utmp utent;
32#endif 32#endif
33 33
34// login defines 34// login defines
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index 9c4b4ddfb..c8940eed7 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -21,7 +21,7 @@ static int new_password(const struct passwd *pw, int amroot, int algo);
21static void set_filesize_limit(int blocks); 21static void set_filesize_limit(int blocks);
22 22
23 23
24int get_algo(char *a) 24static int get_algo(char *a)
25{ 25{
26 int x = 1; /* standard: MD5 */ 26 int x = 1; /* standard: MD5 */
27 27
@@ -31,7 +31,7 @@ int get_algo(char *a)
31} 31}
32 32
33 33
34extern int update_passwd(const struct passwd *pw, char *crypt_pw) 34static int update_passwd(const struct passwd *pw, char *crypt_pw)
35{ 35{
36 char filename[1024]; 36 char filename[1024];
37 char buf[1025]; 37 char buf[1025];
diff --git a/loginutils/vlock.c b/loginutils/vlock.c
index def484ae6..b66a3b1ae 100644
--- a/loginutils/vlock.c
+++ b/loginutils/vlock.c
@@ -51,7 +51,7 @@ static int o_lock_all = 0;
51static struct spwd *spw; 51static struct spwd *spw;
52 52
53/* getspuid - get a shadow entry by uid */ 53/* getspuid - get a shadow entry by uid */
54struct spwd *getspuid(uid_t uid) 54static struct spwd *getspuid(uid_t uid)
55{ 55{
56 struct spwd *sp; 56 struct spwd *sp;
57 struct passwd *mypw; 57 struct passwd *mypw;
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 0d2c328f0..5635ffd69 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -467,8 +467,8 @@ static const char *secu_str[] = {
467 467
468/* Busybox messages and functions */ 468/* Busybox messages and functions */
469 469
470const char * const bb_msg_shared_mem ="could not %s sharedmem buf"; 470static const char * const bb_msg_shared_mem ="could not %s sharedmem buf";
471const char * const bb_msg_op_not_supp =" operation not supported on %s disks"; 471static const char * const bb_msg_op_not_supp =" operation not supported on %s disks";
472 472
473static void bb_ioctl(int fd, int request, void *argp, const char *string) 473static void bb_ioctl(int fd, int request, void *argp, const char *string)
474{ 474{
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 83244fca5..b8268b3ab 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -61,7 +61,7 @@ static struct dep_t *depend;
61static int autoclean, show_only, quiet, do_syslog, verbose; 61static int autoclean, show_only, quiet, do_syslog, verbose;
62static int k_version; 62static int k_version;
63 63
64int parse_tag_value ( char *buffer, char **ptag, char **pvalue ) 64static int parse_tag_value ( char *buffer, char **ptag, char **pvalue )
65{ 65{
66 char *tag, *value; 66 char *tag, *value;
67 67
diff --git a/networking/arping.c b/networking/arping.c
index 7279e8653..95ca1ed2e 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -106,7 +106,7 @@ static int send_pack(int sock, struct in_addr *src_addr,
106 return err; 106 return err;
107} 107}
108 108
109void finish(void) 109static void finish(void)
110{ 110{
111 if (!quiet) { 111 if (!quiet) {
112 printf("Sent %d probes (%d broadcast(s))\n", sent, brd_sent); 112 printf("Sent %d probes (%d broadcast(s))\n", sent, brd_sent);
@@ -129,7 +129,7 @@ void finish(void)
129 exit(!received); 129 exit(!received);
130} 130}
131 131
132void catcher(void) 132static void catcher(void)
133{ 133{
134 struct timeval tv; 134 struct timeval tv;
135 static struct timeval start; 135 static struct timeval start;
@@ -151,7 +151,7 @@ void catcher(void)
151 alarm(1); 151 alarm(1);
152} 152}
153 153
154int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM) 154static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM)
155{ 155{
156 struct timeval tv; 156 struct timeval tv;
157 struct arphdr *ah = (struct arphdr *) buf; 157 struct arphdr *ah = (struct arphdr *) buf;
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index f93f502bd..916948175 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -462,7 +462,7 @@ static struct method_t methods6[] = {
462 { "loopback", loopback_up6, loopback_down6, }, 462 { "loopback", loopback_up6, loopback_down6, },
463}; 463};
464 464
465struct address_family_t addr_inet6 = { 465static struct address_family_t addr_inet6 = {
466 "inet6", 466 "inet6",
467 sizeof(methods6) / sizeof(struct method_t), 467 sizeof(methods6) / sizeof(struct method_t),
468 methods6 468 methods6
@@ -611,7 +611,7 @@ static struct method_t methods[] =
611 { "loopback", loopback_up, loopback_down, }, 611 { "loopback", loopback_up, loopback_down, },
612}; 612};
613 613
614struct address_family_t addr_inet = 614static struct address_family_t addr_inet =
615{ 615{
616 "inet", 616 "inet",
617 sizeof(methods) / sizeof(struct method_t), 617 sizeof(methods) / sizeof(struct method_t),
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index 7e0c75785..da7a67bfe 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -48,7 +48,7 @@ static struct
48 struct rtnl_handle *rth; 48 struct rtnl_handle *rth;
49} filter; 49} filter;
50 50
51void print_link_flags(FILE *fp, unsigned flags, unsigned mdown) 51static void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
52{ 52{
53 fprintf(fp, "<"); 53 fprintf(fp, "<");
54 flags &= ~IFF_RUNNING; 54 flags &= ~IFF_RUNNING;
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index f8713e08b..85c6099ed 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -361,7 +361,7 @@ static int do_add(int cmd, int argc, char **argv)
361 return -1; 361 return -1;
362} 362}
363 363
364int do_del(int argc, char **argv) 364static int do_del(int argc, char **argv)
365{ 365{
366 struct ip_tunnel_parm p; 366 struct ip_tunnel_parm p;
367 367
@@ -381,7 +381,7 @@ int do_del(int argc, char **argv)
381 return -1; 381 return -1;
382} 382}
383 383
384void print_tunnel(struct ip_tunnel_parm *p) 384static void print_tunnel(struct ip_tunnel_parm *p)
385{ 385{
386 char s1[256]; 386 char s1[256];
387 char s2[256]; 387 char s2[256];
diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c
index 9b5260b32..104fbca25 100644
--- a/networking/libiproute/ll_proto.c
+++ b/networking/libiproute/ll_proto.c
@@ -90,7 +90,7 @@ __PF(ECONET,econet)
90#undef __PF 90#undef __PF
91 91
92 92
93char * ll_proto_n2a(unsigned short id, char *buf, int len) 93const char * ll_proto_n2a(unsigned short id, char *buf, int len)
94{ 94{
95 int i; 95 int i;
96 96
diff --git a/networking/libiproute/ll_types.c b/networking/libiproute/ll_types.c
index f39f777e1..6b42426d5 100644
--- a/networking/libiproute/ll_types.c
+++ b/networking/libiproute/ll_types.c
@@ -13,7 +13,7 @@
13 13
14#include <linux/if_arp.h> 14#include <linux/if_arp.h>
15 15
16char * ll_type_n2a(int type, char *buf, int len) 16const char * ll_type_n2a(int type, char *buf, int len)
17{ 17{
18#define __PF(f,n) { ARPHRD_##f, #n }, 18#define __PF(f,n) { ARPHRD_##f, #n },
19static struct { 19static struct {
diff --git a/networking/libiproute/rt_names.c b/networking/libiproute/rt_names.c
index d503645b0..ff93c9e72 100644
--- a/networking/libiproute/rt_names.c
+++ b/networking/libiproute/rt_names.c
@@ -76,7 +76,7 @@ static void rtnl_rtprot_initialize(void)
76 rtnl_rtprot_tab, 256); 76 rtnl_rtprot_tab, 256);
77} 77}
78 78
79char * rtnl_rtprot_n2a(int id, char *buf, int len) 79const char * rtnl_rtprot_n2a(int id, char *buf, int len)
80{ 80{
81 if (id<0 || id>=256) { 81 if (id<0 || id>=256) {
82 snprintf(buf, len, "%d", id); 82 snprintf(buf, len, "%d", id);
@@ -143,7 +143,7 @@ static void rtnl_rtscope_initialize(void)
143 rtnl_rtscope_tab, 256); 143 rtnl_rtscope_tab, 256);
144} 144}
145 145
146char * rtnl_rtscope_n2a(int id, char *buf, int len) 146const char * rtnl_rtscope_n2a(int id, char *buf, int len)
147{ 147{
148 if (id<0 || id>=256) { 148 if (id<0 || id>=256) {
149 snprintf(buf, len, "%d", id); 149 snprintf(buf, len, "%d", id);
@@ -206,7 +206,7 @@ static void rtnl_rtrealm_initialize(void)
206 rtnl_rtrealm_tab, 256); 206 rtnl_rtrealm_tab, 256);
207} 207}
208 208
209char * rtnl_rtrealm_n2a(int id, char *buf, int len) 209const char * rtnl_rtrealm_n2a(int id, char *buf, int len)
210{ 210{
211 if (id<0 || id>=256) { 211 if (id<0 || id>=256) {
212 snprintf(buf, len, "%d", id); 212 snprintf(buf, len, "%d", id);
@@ -272,7 +272,7 @@ static void rtnl_rttable_initialize(void)
272 rtnl_rttable_tab, 256); 272 rtnl_rttable_tab, 256);
273} 273}
274 274
275char * rtnl_rttable_n2a(int id, char *buf, int len) 275const char * rtnl_rttable_n2a(int id, char *buf, int len)
276{ 276{
277 if (id<0 || id>=256) { 277 if (id<0 || id>=256) {
278 snprintf(buf, len, "%d", id); 278 snprintf(buf, len, "%d", id);
@@ -334,7 +334,7 @@ static void rtnl_rtdsfield_initialize(void)
334 rtnl_rtdsfield_tab, 256); 334 rtnl_rtdsfield_tab, 256);
335} 335}
336 336
337char * rtnl_dsfield_n2a(int id, char *buf, int len) 337const char * rtnl_dsfield_n2a(int id, char *buf, int len)
338{ 338{
339 if (id<0 || id>=256) { 339 if (id<0 || id>=256) {
340 snprintf(buf, len, "%d", id); 340 snprintf(buf, len, "%d", id);
diff --git a/networking/nameif.c b/networking/nameif.c
index 10f13b4bc..769b777f0 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -86,7 +86,7 @@ static void serror(const char *s, ...)
86} 86}
87 87
88/* Check ascii str_macaddr, convert and copy to *mac */ 88/* Check ascii str_macaddr, convert and copy to *mac */
89struct ether_addr *cc_macaddr(char *str_macaddr) 89static struct ether_addr *cc_macaddr(char *str_macaddr)
90{ 90{
91 struct ether_addr *lmac, *mac; 91 struct ether_addr *lmac, *mac;
92 92
diff --git a/networking/ping.c b/networking/ping.c
index 50f3930ff..c7cbd7078 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -178,7 +178,10 @@ static int myid, options;
178static unsigned long tmin = ULONG_MAX, tmax, tsum; 178static unsigned long tmin = ULONG_MAX, tmax, tsum;
179static char rcvd_tbl[MAX_DUP_CHK / 8]; 179static char rcvd_tbl[MAX_DUP_CHK / 8];
180 180
181struct hostent *hostent; 181#ifndef CONFIG_FEATURE_FANCY_PING6
182static
183#endif
184 struct hostent *hostent;
182 185
183static void sendping(int); 186static void sendping(int);
184static void pingstats(int); 187static void pingstats(int);
diff --git a/networking/route.c b/networking/route.c
index 5c092f452..9e14944c9 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -485,6 +485,7 @@ void set_flags(char *flagstr, int flags)
485 } 485 }
486} 486}
487 487
488/* also used in netstat */
488void displayroutes(int noresolve, int netstatfmt) 489void displayroutes(int noresolve, int netstatfmt)
489{ 490{
490 char devname[64], flags[16], sdest[16], sgw[16]; 491 char devname[64], flags[16], sdest[16], sgw[16];
diff --git a/networking/tftp.c b/networking/tftp.c
index 3c947318b..095dc58f9 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -71,8 +71,8 @@ static const char *tftp_bb_error_msg[] = {
71 "No such user" 71 "No such user"
72}; 72};
73 73
74const int tftp_cmd_get = 1; 74static const int tftp_cmd_get = 1;
75const int tftp_cmd_put = 2; 75static const int tftp_cmd_put = 2;
76 76
77#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE 77#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
78 78
diff --git a/networking/udhcp/script.h b/networking/udhcp/script.h
index 87a20cc17..71003311c 100644
--- a/networking/udhcp/script.h
+++ b/networking/udhcp/script.h
@@ -1,6 +1,6 @@
1#ifndef _SCRIPT_H 1#ifndef _SCRIPT_H
2#define _SCRIPT_H 2#define _SCRIPT_H
3 3
4void run_script(struct dhcpMessage *packet, const char *name); 4extern void run_script(struct dhcpMessage *packet, const char *name);
5 5
6#endif 6#endif
diff --git a/networking/wget.c b/networking/wget.c
index 45acef4d6..59f30c06d 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -117,9 +117,9 @@ static char *safe_fgets(char *s, int size, FILE *stream)
117/* 117/*
118 * Base64-encode character string 118 * Base64-encode character string
119 * oops... isn't something similar in uuencode.c? 119 * oops... isn't something similar in uuencode.c?
120 * It would be better to use already existing code 120 * XXX: It would be better to use already existing code
121 */ 121 */
122char *base64enc(unsigned char *p, char *buf, int len) { 122static char *base64enc(unsigned char *p, char *buf, int len) {
123 123
124 char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 124 char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
125 "0123456789+/"; 125 "0123456789+/";
diff --git a/procps/top.c b/procps/top.c
index 5963c3554..c0f78f794 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -78,7 +78,7 @@ static int time_sort (procps_status_t *P, procps_status_t *Q)
78 return (int)((Q->stime + Q->utime) - (P->stime + P->utime)); 78 return (int)((Q->stime + Q->utime) - (P->stime + P->utime));
79} 79}
80 80
81int mult_lvl_cmp(void* a, void* b) { 81static int mult_lvl_cmp(void* a, void* b) {
82 int i, cmp_val; 82 int i, cmp_val;
83 83
84 for(i = 0; i < sort_depth; i++) { 84 for(i = 0; i < sort_depth; i++) {