aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-07-17 01:12:36 +0000
committerEric Andersen <andersen@codepoet.org>2001-07-17 01:12:36 +0000
commit044228d5ecb9b79397f9fc915d046cf4538281e2 (patch)
tree4c43e4947b0196d807249f8f6e1c9c679b6bbcde
parent51ded05b3bf4df6f126420d39a40d27ea0728aa9 (diff)
downloadbusybox-w32-044228d5ecb9b79397f9fc915d046cf4538281e2.tar.gz
busybox-w32-044228d5ecb9b79397f9fc915d046cf4538281e2.tar.bz2
busybox-w32-044228d5ecb9b79397f9fc915d046cf4538281e2.zip
This is vodz' latest patch. Sorry it took so long...
1) ping cleanup (compile fix from this patch already applied). 2) traceroute call not spare ntohl() now (and reduce size); 3) Fix for functions not declared static in insmod, ash, vi and mount. 4) a more simple API cmdedit :)) 5) adds "stopped jobs" warning to ash on Ctrl-D and fixes "ignoreeof" option 6) reduce exporting library function index->strchr (traceroute), bzero->memset (syslogd)
-rw-r--r--archival/libunarchive/decompress_unzip.c16
-rw-r--r--archival/libunarchive/unzip.c16
-rw-r--r--ash.c7
-rw-r--r--cmdedit.c11
-rw-r--r--cmdedit.h2
-rw-r--r--editors/vi.c4
-rw-r--r--insmod.c147
-rw-r--r--libbb/unzip.c16
-rw-r--r--modutils/insmod.c147
-rw-r--r--mount.c2
-rw-r--r--networking/ping.c3
-rw-r--r--networking/traceroute.c33
-rw-r--r--ping.c3
-rw-r--r--shell/ash.c7
-rw-r--r--shell/cmdedit.c11
-rw-r--r--shell/cmdedit.h2
-rw-r--r--sysklogd/syslogd.c4
-rw-r--r--syslogd.c4
-rw-r--r--traceroute.c33
-rw-r--r--util-linux/mount.c2
-rw-r--r--vi.c4
21 files changed, 216 insertions, 258 deletions
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index 359957196..ee746216d 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -67,7 +67,7 @@ static char *license_msg[] = {
67#include <string.h> 67#include <string.h>
68#include "libbb.h" 68#include "libbb.h"
69 69
70FILE *in_file, *out_file; 70static FILE *in_file, *out_file;
71 71
72/* these are freed by gz_close */ 72/* these are freed by gz_close */
73static unsigned char *window; 73static unsigned char *window;
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
91static long bytes_out; /* number of output bytes */ 91static long bytes_out; /* number of output bytes */
92static unsigned long outcnt; /* bytes in output buffer */ 92static unsigned long outcnt; /* bytes in output buffer */
93 93
94unsigned hufts; /* track memory usage */ 94static unsigned hufts; /* track memory usage */
95unsigned long bb; /* bit buffer */ 95static unsigned long bb; /* bit buffer */
96unsigned bk; /* bits in bit buffer */ 96static unsigned bk; /* bits in bit buffer */
97 97
98typedef struct huft_s { 98typedef struct huft_s {
99 unsigned char e; /* number of extra bits or operation */ 99 unsigned char e; /* number of extra bits or operation */
@@ -104,7 +104,7 @@ typedef struct huft_s {
104 } v; 104 } v;
105} huft_t; 105} huft_t;
106 106
107unsigned short mask_bits[] = { 107static const unsigned short mask_bits[] = {
108 0x0000, 108 0x0000,
109 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 109 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
110 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff 110 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -154,7 +154,7 @@ static void make_crc_table()
154 * Write the output window window[0..outcnt-1] and update crc and bytes_out. 154 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
155 * (Used for the decompressed data only.) 155 * (Used for the decompressed data only.)
156 */ 156 */
157void flush_window() 157static void flush_window(void)
158{ 158{
159 int n; 159 int n;
160 160
@@ -1021,10 +1021,6 @@ extern void gz_close(int gunzip_pid)
1021 if (waitpid(gunzip_pid, NULL, 0) == -1) { 1021 if (waitpid(gunzip_pid, NULL, 0) == -1) {
1022 printf("Couldnt wait ?"); 1022 printf("Couldnt wait ?");
1023 } 1023 }
1024 if (window) {
1025 free(window); 1024 free(window);
1026 }
1027 if (crc_table) {
1028 free(crc_table); 1025 free(crc_table);
1029 }
1030} 1026}
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c
index 359957196..ee746216d 100644
--- a/archival/libunarchive/unzip.c
+++ b/archival/libunarchive/unzip.c
@@ -67,7 +67,7 @@ static char *license_msg[] = {
67#include <string.h> 67#include <string.h>
68#include "libbb.h" 68#include "libbb.h"
69 69
70FILE *in_file, *out_file; 70static FILE *in_file, *out_file;
71 71
72/* these are freed by gz_close */ 72/* these are freed by gz_close */
73static unsigned char *window; 73static unsigned char *window;
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
91static long bytes_out; /* number of output bytes */ 91static long bytes_out; /* number of output bytes */
92static unsigned long outcnt; /* bytes in output buffer */ 92static unsigned long outcnt; /* bytes in output buffer */
93 93
94unsigned hufts; /* track memory usage */ 94static unsigned hufts; /* track memory usage */
95unsigned long bb; /* bit buffer */ 95static unsigned long bb; /* bit buffer */
96unsigned bk; /* bits in bit buffer */ 96static unsigned bk; /* bits in bit buffer */
97 97
98typedef struct huft_s { 98typedef struct huft_s {
99 unsigned char e; /* number of extra bits or operation */ 99 unsigned char e; /* number of extra bits or operation */
@@ -104,7 +104,7 @@ typedef struct huft_s {
104 } v; 104 } v;
105} huft_t; 105} huft_t;
106 106
107unsigned short mask_bits[] = { 107static const unsigned short mask_bits[] = {
108 0x0000, 108 0x0000,
109 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 109 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
110 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff 110 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -154,7 +154,7 @@ static void make_crc_table()
154 * Write the output window window[0..outcnt-1] and update crc and bytes_out. 154 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
155 * (Used for the decompressed data only.) 155 * (Used for the decompressed data only.)
156 */ 156 */
157void flush_window() 157static void flush_window(void)
158{ 158{
159 int n; 159 int n;
160 160
@@ -1021,10 +1021,6 @@ extern void gz_close(int gunzip_pid)
1021 if (waitpid(gunzip_pid, NULL, 0) == -1) { 1021 if (waitpid(gunzip_pid, NULL, 0) == -1) {
1022 printf("Couldnt wait ?"); 1022 printf("Couldnt wait ?");
1023 } 1023 }
1024 if (window) {
1025 free(window); 1024 free(window);
1026 }
1027 if (crc_table) {
1028 free(crc_table); 1025 free(crc_table);
1029 }
1030} 1026}
diff --git a/ash.c b/ash.c
index 334d2fddd..d16da82db 100644
--- a/ash.c
+++ b/ash.c
@@ -6204,8 +6204,7 @@ retry:
6204 if (!iflag) 6204 if (!iflag)
6205 nr = safe_read(parsefile->fd, buf, BUFSIZ - 1); 6205 nr = safe_read(parsefile->fd, buf, BUFSIZ - 1);
6206 else { 6206 else {
6207 cmdedit_read_input((char*)cmdedit_prompt, buf); 6207 nr = cmdedit_read_input((char*)cmdedit_prompt, buf);
6208 nr = strlen(buf);
6209 } 6208 }
6210 } 6209 }
6211#else 6210#else
@@ -9445,7 +9444,7 @@ static char *wordtext; /* text of last word returned by readtok
9445 9444
9446static struct nodelist *backquotelist; 9445static struct nodelist *backquotelist;
9447static union node *redirnode; 9446static union node *redirnode;
9448struct heredoc *heredoc; 9447static struct heredoc *heredoc;
9449static int quoteflag; /* set if (part of) last token was quoted */ 9448static int quoteflag; /* set if (part of) last token was quoted */
9450static int startlinno; /* line # where last token started */ 9449static int startlinno; /* line # where last token started */
9451 9450
@@ -12917,7 +12916,7 @@ findvar(struct var **vpp, const char *name)
12917/* 12916/*
12918 * Copyright (c) 1999 Herbert Xu <herbert@debian.org> 12917 * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
12919 * This file contains code for the times builtin. 12918 * This file contains code for the times builtin.
12920 * $Id: ash.c,v 1.10 2001/07/12 20:26:31 andersen Exp $ 12919 * $Id: ash.c,v 1.11 2001/07/17 01:12:35 andersen Exp $
12921 */ 12920 */
12922static int timescmd (int argc, char **argv) 12921static int timescmd (int argc, char **argv)
12923{ 12922{
diff --git a/cmdedit.c b/cmdedit.c
index 540eb7ea7..69f833747 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -1153,7 +1153,8 @@ enum {
1153 * 1153 *
1154 */ 1154 */
1155 1155
1156extern void cmdedit_read_input(char *prompt, char command[BUFSIZ]) 1156
1157int cmdedit_read_input(char *prompt, char command[BUFSIZ])
1157{ 1158{
1158 1159
1159 int break_out = 0; 1160 int break_out = 0;
@@ -1231,10 +1232,15 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
1231 * if the len=0 and no chars to delete */ 1232 * if the len=0 and no chars to delete */
1232 if (len == 0) { 1233 if (len == 0) {
1233prepare_to_die: 1234prepare_to_die:
1235#if !defined(BB_FEATURE_ASH)
1234 printf("exit"); 1236 printf("exit");
1235 goto_new_line(); 1237 goto_new_line();
1236 /* cmdedit_reset_term() called in atexit */ 1238 /* cmdedit_reset_term() called in atexit */
1237 exit(EXIT_SUCCESS); 1239 exit(EXIT_SUCCESS);
1240#else
1241 break_out = -1; /* for control stoped jobs */
1242 break;
1243#endif
1238 } else { 1244 } else {
1239 input_delete(); 1245 input_delete();
1240 } 1246 }
@@ -1455,8 +1461,10 @@ prepare_to_die:
1455 num_ok_lines++; 1461 num_ok_lines++;
1456#endif 1462#endif
1457 } 1463 }
1464 if(break_out>0) {
1458 command[len++] = '\n'; /* set '\n' */ 1465 command[len++] = '\n'; /* set '\n' */
1459 command[len] = 0; 1466 command[len] = 0;
1467 }
1460#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) 1468#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
1461 input_tab(0); /* strong free */ 1469 input_tab(0); /* strong free */
1462#endif 1470#endif
@@ -1464,6 +1472,7 @@ prepare_to_die:
1464 free(cmdedit_prompt); 1472 free(cmdedit_prompt);
1465#endif 1473#endif
1466 cmdedit_reset_term(); 1474 cmdedit_reset_term();
1475 return len;
1467} 1476}
1468 1477
1469 1478
diff --git a/cmdedit.h b/cmdedit.h
index 1482da3b8..83893572a 100644
--- a/cmdedit.h
+++ b/cmdedit.h
@@ -1,6 +1,6 @@
1#ifndef CMDEDIT_H 1#ifndef CMDEDIT_H
2#define CMDEDIT_H 2#define CMDEDIT_H
3 3
4void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */ 4int cmdedit_read_input(char* promptStr, char* command);
5 5
6#endif /* CMDEDIT_H */ 6#endif /* CMDEDIT_H */
diff --git a/editors/vi.c b/editors/vi.c
index 9e3355685..f75c884eb 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -18,8 +18,8 @@
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 19 */
20 20
21char *vi_Version = 21static const char vi_Version[] =
22 "$Id: vi.c,v 1.11 2001/07/02 18:06:14 andersen Exp $"; 22 "$Id: vi.c,v 1.12 2001/07/17 01:12:36 andersen Exp $";
23 23
24/* 24/*
25 * To compile for standalone use: 25 * To compile for standalone use:
diff --git a/insmod.c b/insmod.c
index 4b0051594..b457fa81c 100644
--- a/insmod.c
+++ b/insmod.c
@@ -130,7 +130,7 @@
130#ifndef MODUTILS_MODULE_H 130#ifndef MODUTILS_MODULE_H
131static const int MODUTILS_MODULE_H = 1; 131static const int MODUTILS_MODULE_H = 1;
132 132
133#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $" 133#ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $"
134 134
135/* This file contains the structures used by the 2.0 and 2.1 kernels. 135/* This file contains the structures used by the 2.0 and 2.1 kernels.
136 We do not use the kernel headers directly because we do not wish 136 We do not use the kernel headers directly because we do not wish
@@ -347,7 +347,7 @@ int delete_module(const char *);
347#ifndef MODUTILS_OBJ_H 347#ifndef MODUTILS_OBJ_H
348static const int MODUTILS_OBJ_H = 1; 348static const int MODUTILS_OBJ_H = 1;
349 349
350#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $" 350#ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $"
351 351
352/* The relocatable object is manipulated using elfin types. */ 352/* The relocatable object is manipulated using elfin types. */
353 353
@@ -537,78 +537,73 @@ struct obj_symbol_patch
537 537
538/* Generic object manipulation routines. */ 538/* Generic object manipulation routines. */
539 539
540unsigned long obj_elf_hash(const char *); 540static unsigned long obj_elf_hash(const char *);
541 541
542unsigned long obj_elf_hash_n(const char *, unsigned long len); 542static unsigned long obj_elf_hash_n(const char *, unsigned long len);
543 543
544struct obj_symbol *obj_add_symbol (struct obj_file *f, const char *name, 544static struct obj_symbol *obj_find_symbol (struct obj_file *f,
545 unsigned long symidx, int info, int secidx,
546 ElfW(Addr) value, unsigned long size);
547
548struct obj_symbol *obj_find_symbol (struct obj_file *f,
549 const char *name); 545 const char *name);
550 546
551ElfW(Addr) obj_symbol_final_value(struct obj_file *f, 547static ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
552 struct obj_symbol *sym); 548 struct obj_symbol *sym);
553 549
554void obj_set_symbol_compare(struct obj_file *f, 550static void obj_set_symbol_compare(struct obj_file *f,
555 int (*cmp)(const char *, const char *), 551 int (*cmp)(const char *, const char *),
556 unsigned long (*hash)(const char *)); 552 unsigned long (*hash)(const char *));
557 553
558struct obj_section *obj_find_section (struct obj_file *f, 554static struct obj_section *obj_find_section (struct obj_file *f,
559 const char *name); 555 const char *name);
560 556
561void obj_insert_section_load_order (struct obj_file *f, 557static void obj_insert_section_load_order (struct obj_file *f,
562 struct obj_section *sec); 558 struct obj_section *sec);
563 559
564struct obj_section *obj_create_alloced_section (struct obj_file *f, 560static struct obj_section *obj_create_alloced_section (struct obj_file *f,
565 const char *name, 561 const char *name,
566 unsigned long align, 562 unsigned long align,
567 unsigned long size); 563 unsigned long size);
568 564
569struct obj_section *obj_create_alloced_section_first (struct obj_file *f, 565static struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
570 const char *name, 566 const char *name,
571 unsigned long align, 567 unsigned long align,
572 unsigned long size); 568 unsigned long size);
573 569
574void *obj_extend_section (struct obj_section *sec, unsigned long more); 570static void *obj_extend_section (struct obj_section *sec, unsigned long more);
575 571
576int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, 572static int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
577 const char *string); 573 const char *string);
578 574
579int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, 575static int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
580 struct obj_symbol *sym); 576 struct obj_symbol *sym);
581 577
582int obj_check_undefineds(struct obj_file *f); 578static int obj_check_undefineds(struct obj_file *f);
583 579
584void obj_allocate_commons(struct obj_file *f); 580static void obj_allocate_commons(struct obj_file *f);
585 581
586unsigned long obj_load_size (struct obj_file *f); 582static unsigned long obj_load_size (struct obj_file *f);
587 583
588int obj_relocate (struct obj_file *f, ElfW(Addr) base); 584static int obj_relocate (struct obj_file *f, ElfW(Addr) base);
589 585
590struct obj_file *obj_load(FILE *f, int loadprogbits); 586static struct obj_file *obj_load(FILE *f, int loadprogbits);
591 587
592int obj_create_image (struct obj_file *f, char *image); 588static int obj_create_image (struct obj_file *f, char *image);
593 589
594/* Architecture specific manipulation routines. */ 590/* Architecture specific manipulation routines. */
595 591
596struct obj_file *arch_new_file (void); 592static struct obj_file *arch_new_file (void);
597 593
598struct obj_section *arch_new_section (void); 594static struct obj_section *arch_new_section (void);
599 595
600struct obj_symbol *arch_new_symbol (void); 596static struct obj_symbol *arch_new_symbol (void);
601 597
602enum obj_reloc arch_apply_relocation (struct obj_file *f, 598static enum obj_reloc arch_apply_relocation (struct obj_file *f,
603 struct obj_section *targsec, 599 struct obj_section *targsec,
604 struct obj_section *symsec, 600 struct obj_section *symsec,
605 struct obj_symbol *sym, 601 struct obj_symbol *sym,
606 ElfW(RelM) *rel, ElfW(Addr) value); 602 ElfW(RelM) *rel, ElfW(Addr) value);
607 603
608int arch_create_got (struct obj_file *f); 604static int arch_create_got (struct obj_file *f);
609 605
610struct new_module; 606static int arch_init_module (struct obj_file *f, struct new_module *);
611int arch_init_module (struct obj_file *f, struct new_module *);
612 607
613#endif /* obj.h */ 608#endif /* obj.h */
614//---------------------------------------------------------------------------- 609//----------------------------------------------------------------------------
@@ -624,10 +619,10 @@ static const int STRVERSIONLEN = 32;
624 619
625/*======================================================================*/ 620/*======================================================================*/
626 621
627int flag_force_load = 0; 622static int flag_force_load = 0;
628int flag_autoclean = 0; 623static int flag_autoclean = 0;
629int flag_verbose = 0; 624static int flag_verbose = 0;
630int flag_export = 1; 625static int flag_export = 1;
631 626
632 627
633/*======================================================================*/ 628/*======================================================================*/
@@ -700,12 +695,12 @@ struct external_module {
700 struct new_module_symbol *syms; 695 struct new_module_symbol *syms;
701}; 696};
702 697
703struct new_module_symbol *ksyms; 698static struct new_module_symbol *ksyms;
704size_t nksyms; 699static size_t nksyms;
705 700
706struct external_module *ext_modules; 701static struct external_module *ext_modules;
707int n_ext_modules; 702static int n_ext_modules;
708int n_ext_modules_used; 703static int n_ext_modules_used;
709extern int delete_module(const char *); 704extern int delete_module(const char *);
710 705
711static char m_filename[FILENAME_MAX + 1]; 706static char m_filename[FILENAME_MAX + 1];
@@ -740,7 +735,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
740 735
741/*======================================================================*/ 736/*======================================================================*/
742 737
743struct obj_file *arch_new_file(void) 738static struct obj_file *arch_new_file(void)
744{ 739{
745 struct arch_file *f; 740 struct arch_file *f;
746 f = xmalloc(sizeof(*f)); 741 f = xmalloc(sizeof(*f));
@@ -758,12 +753,12 @@ struct obj_file *arch_new_file(void)
758 return &f->root; 753 return &f->root;
759} 754}
760 755
761struct obj_section *arch_new_section(void) 756static struct obj_section *arch_new_section(void)
762{ 757{
763 return xmalloc(sizeof(struct obj_section)); 758 return xmalloc(sizeof(struct obj_section));
764} 759}
765 760
766struct obj_symbol *arch_new_symbol(void) 761static struct obj_symbol *arch_new_symbol(void)
767{ 762{
768 struct arch_symbol *sym; 763 struct arch_symbol *sym;
769 sym = xmalloc(sizeof(*sym)); 764 sym = xmalloc(sizeof(*sym));
@@ -778,7 +773,7 @@ struct obj_symbol *arch_new_symbol(void)
778 return &sym->root; 773 return &sym->root;
779} 774}
780 775
781enum obj_reloc 776static enum obj_reloc
782arch_apply_relocation(struct obj_file *f, 777arch_apply_relocation(struct obj_file *f,
783 struct obj_section *targsec, 778 struct obj_section *targsec,
784 struct obj_section *symsec, 779 struct obj_section *symsec,
@@ -1140,7 +1135,7 @@ arch_apply_relocation(struct obj_file *f,
1140 return ret; 1135 return ret;
1141} 1136}
1142 1137
1143int arch_create_got(struct obj_file *f) 1138static int arch_create_got(struct obj_file *f)
1144{ 1139{
1145#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES) 1140#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
1146 struct arch_file *ifile = (struct arch_file *) f; 1141 struct arch_file *ifile = (struct arch_file *) f;
@@ -1271,7 +1266,7 @@ int arch_create_got(struct obj_file *f)
1271 return 1; 1266 return 1;
1272} 1267}
1273 1268
1274int arch_init_module(struct obj_file *f, struct new_module *mod) 1269static int arch_init_module(struct obj_file *f, struct new_module *mod)
1275{ 1270{
1276 return 1; 1271 return 1;
1277} 1272}
@@ -1280,7 +1275,7 @@ int arch_init_module(struct obj_file *f, struct new_module *mod)
1280/*======================================================================*/ 1275/*======================================================================*/
1281 1276
1282/* Standard ELF hash function. */ 1277/* Standard ELF hash function. */
1283inline unsigned long obj_elf_hash_n(const char *name, unsigned long n) 1278static inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
1284{ 1279{
1285 unsigned long h = 0; 1280 unsigned long h = 0;
1286 unsigned long g; 1281 unsigned long g;
@@ -1298,7 +1293,7 @@ inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
1298 return h; 1293 return h;
1299} 1294}
1300 1295
1301unsigned long obj_elf_hash(const char *name) 1296static unsigned long obj_elf_hash(const char *name)
1302{ 1297{
1303 return obj_elf_hash_n(name, strlen(name)); 1298 return obj_elf_hash_n(name, strlen(name));
1304} 1299}
@@ -1309,25 +1304,15 @@ unsigned long obj_elf_hash(const char *name)
1309static int get_kernel_version(char str[STRVERSIONLEN]) 1304static int get_kernel_version(char str[STRVERSIONLEN])
1310{ 1305{
1311 struct utsname uts_info; 1306 struct utsname uts_info;
1312 char *p, *q; 1307 int kv;
1313 int a, b, c;
1314 1308
1315 if (uname(&uts_info) < 0) 1309 if (uname(&uts_info) < 0)
1316 return -1; 1310 return -1;
1317 strncpy(str, uts_info.release, STRVERSIONLEN); 1311 strncpy(str, uts_info.release, STRVERSIONLEN);
1318 p = uts_info.release;
1319 1312
1320 a = strtoul(p, &p, 10); 1313 kv = get_kernel_revision();
1321 if (*p != '.') 1314 if(kv==0)
1322 return -1;
1323 b = strtoul(p + 1, &p, 10);
1324 if (*p != '.')
1325 return -1; 1315 return -1;
1326 c = strtoul(p + 1, &q, 10);
1327 if (p + 1 == q)
1328 return -1;
1329
1330 return a << 16 | b << 8 | c;
1331} 1316}
1332 1317
1333/* String comparison for non-co-versioned kernel and module. */ 1318/* String comparison for non-co-versioned kernel and module. */
@@ -1355,7 +1340,7 @@ static unsigned long ncv_symbol_hash(const char *str)
1355 return obj_elf_hash_n(str, len); 1340 return obj_elf_hash_n(str, len);
1356} 1341}
1357 1342
1358void 1343static void
1359obj_set_symbol_compare(struct obj_file *f, 1344obj_set_symbol_compare(struct obj_file *f,
1360 int (*cmp) (const char *, const char *), 1345 int (*cmp) (const char *, const char *),
1361 unsigned long (*hash) (const char *)) 1346 unsigned long (*hash) (const char *))
@@ -1383,8 +1368,8 @@ obj_set_symbol_compare(struct obj_file *f,
1383 1368
1384#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ 1369#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
1385 1370
1386 1371static struct obj_symbol *
1387struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, 1372obj_add_symbol(struct obj_file *f, const char *name,
1388 unsigned long symidx, int info, 1373 unsigned long symidx, int info,
1389 int secidx, ElfW(Addr) value, 1374 int secidx, ElfW(Addr) value,
1390 unsigned long size) 1375 unsigned long size)
@@ -1478,7 +1463,8 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
1478 return sym; 1463 return sym;
1479} 1464}
1480 1465
1481struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name) 1466static struct obj_symbol *
1467obj_find_symbol(struct obj_file *f, const char *name)
1482{ 1468{
1483 struct obj_symbol *sym; 1469 struct obj_symbol *sym;
1484 unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS; 1470 unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS;
@@ -1490,7 +1476,7 @@ struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
1490 return NULL; 1476 return NULL;
1491} 1477}
1492 1478
1493ElfW(Addr) 1479static ElfW(Addr)
1494 obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym) 1480 obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym)
1495{ 1481{
1496 if (sym) { 1482 if (sym) {
@@ -1504,7 +1490,7 @@ ElfW(Addr)
1504 } 1490 }
1505} 1491}
1506 1492
1507struct obj_section *obj_find_section(struct obj_file *f, const char *name) 1493static struct obj_section *obj_find_section(struct obj_file *f, const char *name)
1508{ 1494{
1509 int i, n = f->header.e_shnum; 1495 int i, n = f->header.e_shnum;
1510 1496
@@ -1537,7 +1523,7 @@ static int obj_load_order_prio(struct obj_section *a)
1537 return ac; 1523 return ac;
1538} 1524}
1539 1525
1540void 1526static void
1541obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec) 1527obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
1542{ 1528{
1543 struct obj_section **p; 1529 struct obj_section **p;
@@ -1549,7 +1535,7 @@ obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
1549 *p = sec; 1535 *p = sec;
1550} 1536}
1551 1537
1552struct obj_section *obj_create_alloced_section(struct obj_file *f, 1538static struct obj_section *obj_create_alloced_section(struct obj_file *f,
1553 const char *name, 1539 const char *name,
1554 unsigned long align, 1540 unsigned long align,
1555 unsigned long size) 1541 unsigned long size)
@@ -1575,7 +1561,7 @@ struct obj_section *obj_create_alloced_section(struct obj_file *f,
1575 return sec; 1561 return sec;
1576} 1562}
1577 1563
1578struct obj_section *obj_create_alloced_section_first(struct obj_file *f, 1564static struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
1579 const char *name, 1565 const char *name,
1580 unsigned long align, 1566 unsigned long align,
1581 unsigned long size) 1567 unsigned long size)
@@ -1604,7 +1590,7 @@ struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
1604 return sec; 1590 return sec;
1605} 1591}
1606 1592
1607void *obj_extend_section(struct obj_section *sec, unsigned long more) 1593static void *obj_extend_section(struct obj_section *sec, unsigned long more)
1608{ 1594{
1609 unsigned long oldsize = sec->header.sh_size; 1595 unsigned long oldsize = sec->header.sh_size;
1610 if (more) { 1596 if (more) {
@@ -1614,7 +1600,6 @@ void *obj_extend_section(struct obj_section *sec, unsigned long more)
1614} 1600}
1615 1601
1616 1602
1617
1618/* Conditionally add the symbols from the given symbol set to the 1603/* Conditionally add the symbols from the given symbol set to the
1619 new module. */ 1604 new module. */
1620 1605
@@ -2631,7 +2616,7 @@ new_init_module(const char *m_name, struct obj_file *f,
2631 2616
2632/*======================================================================*/ 2617/*======================================================================*/
2633 2618
2634int 2619static int
2635obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, 2620obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
2636 const char *string) 2621 const char *string)
2637{ 2622{
@@ -2660,7 +2645,7 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
2660 return 1; 2645 return 1;
2661} 2646}
2662 2647
2663int 2648static int
2664obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, 2649obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
2665 struct obj_symbol *sym) 2650 struct obj_symbol *sym)
2666{ 2651{
@@ -2676,7 +2661,7 @@ obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
2676 return 1; 2661 return 1;
2677} 2662}
2678 2663
2679int obj_check_undefineds(struct obj_file *f) 2664static int obj_check_undefineds(struct obj_file *f)
2680{ 2665{
2681 unsigned long i; 2666 unsigned long i;
2682 int ret = 1; 2667 int ret = 1;
@@ -2698,7 +2683,7 @@ int obj_check_undefineds(struct obj_file *f)
2698 return ret; 2683 return ret;
2699} 2684}
2700 2685
2701void obj_allocate_commons(struct obj_file *f) 2686static void obj_allocate_commons(struct obj_file *f)
2702{ 2687{
2703 struct common_entry { 2688 struct common_entry {
2704 struct common_entry *next; 2689 struct common_entry *next;
@@ -2807,7 +2792,7 @@ void obj_allocate_commons(struct obj_file *f)
2807 } 2792 }
2808} 2793}
2809 2794
2810unsigned long obj_load_size(struct obj_file *f) 2795static unsigned long obj_load_size(struct obj_file *f)
2811{ 2796{
2812 unsigned long dot = 0; 2797 unsigned long dot = 0;
2813 struct obj_section *sec; 2798 struct obj_section *sec;
@@ -2828,7 +2813,7 @@ unsigned long obj_load_size(struct obj_file *f)
2828 return dot; 2813 return dot;
2829} 2814}
2830 2815
2831int obj_relocate(struct obj_file *f, ElfW(Addr) base) 2816static int obj_relocate(struct obj_file *f, ElfW(Addr) base)
2832{ 2817{
2833 int i, n = f->header.e_shnum; 2818 int i, n = f->header.e_shnum;
2834 int ret = 1; 2819 int ret = 1;
@@ -2958,7 +2943,7 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
2958 return ret; 2943 return ret;
2959} 2944}
2960 2945
2961int obj_create_image(struct obj_file *f, char *image) 2946static int obj_create_image(struct obj_file *f, char *image)
2962{ 2947{
2963 struct obj_section *sec; 2948 struct obj_section *sec;
2964 ElfW(Addr) base = f->baseaddr; 2949 ElfW(Addr) base = f->baseaddr;
@@ -2980,7 +2965,7 @@ int obj_create_image(struct obj_file *f, char *image)
2980 2965
2981/*======================================================================*/ 2966/*======================================================================*/
2982 2967
2983struct obj_file *obj_load(FILE * fp, int loadprogbits) 2968static struct obj_file *obj_load(FILE * fp, int loadprogbits)
2984{ 2969{
2985 struct obj_file *f; 2970 struct obj_file *f;
2986 ElfW(Shdr) * section_headers; 2971 ElfW(Shdr) * section_headers;
@@ -3186,7 +3171,7 @@ struct obj_file *obj_load(FILE * fp, int loadprogbits)
3186 * kernel for the module 3171 * kernel for the module
3187 */ 3172 */
3188 3173
3189int obj_load_progbits(FILE * fp, struct obj_file* f) 3174static int obj_load_progbits(FILE * fp, struct obj_file* f)
3190{ 3175{
3191 char* imagebase = (char*) f->imagebase; 3176 char* imagebase = (char*) f->imagebase;
3192 ElfW(Addr) base = f->baseaddr; 3177 ElfW(Addr) base = f->baseaddr;
diff --git a/libbb/unzip.c b/libbb/unzip.c
index 359957196..ee746216d 100644
--- a/libbb/unzip.c
+++ b/libbb/unzip.c
@@ -67,7 +67,7 @@ static char *license_msg[] = {
67#include <string.h> 67#include <string.h>
68#include "libbb.h" 68#include "libbb.h"
69 69
70FILE *in_file, *out_file; 70static FILE *in_file, *out_file;
71 71
72/* these are freed by gz_close */ 72/* these are freed by gz_close */
73static unsigned char *window; 73static unsigned char *window;
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
91static long bytes_out; /* number of output bytes */ 91static long bytes_out; /* number of output bytes */
92static unsigned long outcnt; /* bytes in output buffer */ 92static unsigned long outcnt; /* bytes in output buffer */
93 93
94unsigned hufts; /* track memory usage */ 94static unsigned hufts; /* track memory usage */
95unsigned long bb; /* bit buffer */ 95static unsigned long bb; /* bit buffer */
96unsigned bk; /* bits in bit buffer */ 96static unsigned bk; /* bits in bit buffer */
97 97
98typedef struct huft_s { 98typedef struct huft_s {
99 unsigned char e; /* number of extra bits or operation */ 99 unsigned char e; /* number of extra bits or operation */
@@ -104,7 +104,7 @@ typedef struct huft_s {
104 } v; 104 } v;
105} huft_t; 105} huft_t;
106 106
107unsigned short mask_bits[] = { 107static const unsigned short mask_bits[] = {
108 0x0000, 108 0x0000,
109 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 109 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
110 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff 110 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -154,7 +154,7 @@ static void make_crc_table()
154 * Write the output window window[0..outcnt-1] and update crc and bytes_out. 154 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
155 * (Used for the decompressed data only.) 155 * (Used for the decompressed data only.)
156 */ 156 */
157void flush_window() 157static void flush_window(void)
158{ 158{
159 int n; 159 int n;
160 160
@@ -1021,10 +1021,6 @@ extern void gz_close(int gunzip_pid)
1021 if (waitpid(gunzip_pid, NULL, 0) == -1) { 1021 if (waitpid(gunzip_pid, NULL, 0) == -1) {
1022 printf("Couldnt wait ?"); 1022 printf("Couldnt wait ?");
1023 } 1023 }
1024 if (window) {
1025 free(window); 1024 free(window);
1026 }
1027 if (crc_table) {
1028 free(crc_table); 1025 free(crc_table);
1029 }
1030} 1026}
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 4b0051594..b457fa81c 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -130,7 +130,7 @@
130#ifndef MODUTILS_MODULE_H 130#ifndef MODUTILS_MODULE_H
131static const int MODUTILS_MODULE_H = 1; 131static const int MODUTILS_MODULE_H = 1;
132 132
133#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $" 133#ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $"
134 134
135/* This file contains the structures used by the 2.0 and 2.1 kernels. 135/* This file contains the structures used by the 2.0 and 2.1 kernels.
136 We do not use the kernel headers directly because we do not wish 136 We do not use the kernel headers directly because we do not wish
@@ -347,7 +347,7 @@ int delete_module(const char *);
347#ifndef MODUTILS_OBJ_H 347#ifndef MODUTILS_OBJ_H
348static const int MODUTILS_OBJ_H = 1; 348static const int MODUTILS_OBJ_H = 1;
349 349
350#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $" 350#ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $"
351 351
352/* The relocatable object is manipulated using elfin types. */ 352/* The relocatable object is manipulated using elfin types. */
353 353
@@ -537,78 +537,73 @@ struct obj_symbol_patch
537 537
538/* Generic object manipulation routines. */ 538/* Generic object manipulation routines. */
539 539
540unsigned long obj_elf_hash(const char *); 540static unsigned long obj_elf_hash(const char *);
541 541
542unsigned long obj_elf_hash_n(const char *, unsigned long len); 542static unsigned long obj_elf_hash_n(const char *, unsigned long len);
543 543
544struct obj_symbol *obj_add_symbol (struct obj_file *f, const char *name, 544static struct obj_symbol *obj_find_symbol (struct obj_file *f,
545 unsigned long symidx, int info, int secidx,
546 ElfW(Addr) value, unsigned long size);
547
548struct obj_symbol *obj_find_symbol (struct obj_file *f,
549 const char *name); 545 const char *name);
550 546
551ElfW(Addr) obj_symbol_final_value(struct obj_file *f, 547static ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
552 struct obj_symbol *sym); 548 struct obj_symbol *sym);
553 549
554void obj_set_symbol_compare(struct obj_file *f, 550static void obj_set_symbol_compare(struct obj_file *f,
555 int (*cmp)(const char *, const char *), 551 int (*cmp)(const char *, const char *),
556 unsigned long (*hash)(const char *)); 552 unsigned long (*hash)(const char *));
557 553
558struct obj_section *obj_find_section (struct obj_file *f, 554static struct obj_section *obj_find_section (struct obj_file *f,
559 const char *name); 555 const char *name);
560 556
561void obj_insert_section_load_order (struct obj_file *f, 557static void obj_insert_section_load_order (struct obj_file *f,
562 struct obj_section *sec); 558 struct obj_section *sec);
563 559
564struct obj_section *obj_create_alloced_section (struct obj_file *f, 560static struct obj_section *obj_create_alloced_section (struct obj_file *f,
565 const char *name, 561 const char *name,
566 unsigned long align, 562 unsigned long align,
567 unsigned long size); 563 unsigned long size);
568 564
569struct obj_section *obj_create_alloced_section_first (struct obj_file *f, 565static struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
570 const char *name, 566 const char *name,
571 unsigned long align, 567 unsigned long align,
572 unsigned long size); 568 unsigned long size);
573 569
574void *obj_extend_section (struct obj_section *sec, unsigned long more); 570static void *obj_extend_section (struct obj_section *sec, unsigned long more);
575 571
576int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, 572static int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
577 const char *string); 573 const char *string);
578 574
579int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, 575static int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
580 struct obj_symbol *sym); 576 struct obj_symbol *sym);
581 577
582int obj_check_undefineds(struct obj_file *f); 578static int obj_check_undefineds(struct obj_file *f);
583 579
584void obj_allocate_commons(struct obj_file *f); 580static void obj_allocate_commons(struct obj_file *f);
585 581
586unsigned long obj_load_size (struct obj_file *f); 582static unsigned long obj_load_size (struct obj_file *f);
587 583
588int obj_relocate (struct obj_file *f, ElfW(Addr) base); 584static int obj_relocate (struct obj_file *f, ElfW(Addr) base);
589 585
590struct obj_file *obj_load(FILE *f, int loadprogbits); 586static struct obj_file *obj_load(FILE *f, int loadprogbits);
591 587
592int obj_create_image (struct obj_file *f, char *image); 588static int obj_create_image (struct obj_file *f, char *image);
593 589
594/* Architecture specific manipulation routines. */ 590/* Architecture specific manipulation routines. */
595 591
596struct obj_file *arch_new_file (void); 592static struct obj_file *arch_new_file (void);
597 593
598struct obj_section *arch_new_section (void); 594static struct obj_section *arch_new_section (void);
599 595
600struct obj_symbol *arch_new_symbol (void); 596static struct obj_symbol *arch_new_symbol (void);
601 597
602enum obj_reloc arch_apply_relocation (struct obj_file *f, 598static enum obj_reloc arch_apply_relocation (struct obj_file *f,
603 struct obj_section *targsec, 599 struct obj_section *targsec,
604 struct obj_section *symsec, 600 struct obj_section *symsec,
605 struct obj_symbol *sym, 601 struct obj_symbol *sym,
606 ElfW(RelM) *rel, ElfW(Addr) value); 602 ElfW(RelM) *rel, ElfW(Addr) value);
607 603
608int arch_create_got (struct obj_file *f); 604static int arch_create_got (struct obj_file *f);
609 605
610struct new_module; 606static int arch_init_module (struct obj_file *f, struct new_module *);
611int arch_init_module (struct obj_file *f, struct new_module *);
612 607
613#endif /* obj.h */ 608#endif /* obj.h */
614//---------------------------------------------------------------------------- 609//----------------------------------------------------------------------------
@@ -624,10 +619,10 @@ static const int STRVERSIONLEN = 32;
624 619
625/*======================================================================*/ 620/*======================================================================*/
626 621
627int flag_force_load = 0; 622static int flag_force_load = 0;
628int flag_autoclean = 0; 623static int flag_autoclean = 0;
629int flag_verbose = 0; 624static int flag_verbose = 0;
630int flag_export = 1; 625static int flag_export = 1;
631 626
632 627
633/*======================================================================*/ 628/*======================================================================*/
@@ -700,12 +695,12 @@ struct external_module {
700 struct new_module_symbol *syms; 695 struct new_module_symbol *syms;
701}; 696};
702 697
703struct new_module_symbol *ksyms; 698static struct new_module_symbol *ksyms;
704size_t nksyms; 699static size_t nksyms;
705 700
706struct external_module *ext_modules; 701static struct external_module *ext_modules;
707int n_ext_modules; 702static int n_ext_modules;
708int n_ext_modules_used; 703static int n_ext_modules_used;
709extern int delete_module(const char *); 704extern int delete_module(const char *);
710 705
711static char m_filename[FILENAME_MAX + 1]; 706static char m_filename[FILENAME_MAX + 1];
@@ -740,7 +735,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
740 735
741/*======================================================================*/ 736/*======================================================================*/
742 737
743struct obj_file *arch_new_file(void) 738static struct obj_file *arch_new_file(void)
744{ 739{
745 struct arch_file *f; 740 struct arch_file *f;
746 f = xmalloc(sizeof(*f)); 741 f = xmalloc(sizeof(*f));
@@ -758,12 +753,12 @@ struct obj_file *arch_new_file(void)
758 return &f->root; 753 return &f->root;
759} 754}
760 755
761struct obj_section *arch_new_section(void) 756static struct obj_section *arch_new_section(void)
762{ 757{
763 return xmalloc(sizeof(struct obj_section)); 758 return xmalloc(sizeof(struct obj_section));
764} 759}
765 760
766struct obj_symbol *arch_new_symbol(void) 761static struct obj_symbol *arch_new_symbol(void)
767{ 762{
768 struct arch_symbol *sym; 763 struct arch_symbol *sym;
769 sym = xmalloc(sizeof(*sym)); 764 sym = xmalloc(sizeof(*sym));
@@ -778,7 +773,7 @@ struct obj_symbol *arch_new_symbol(void)
778 return &sym->root; 773 return &sym->root;
779} 774}
780 775
781enum obj_reloc 776static enum obj_reloc
782arch_apply_relocation(struct obj_file *f, 777arch_apply_relocation(struct obj_file *f,
783 struct obj_section *targsec, 778 struct obj_section *targsec,
784 struct obj_section *symsec, 779 struct obj_section *symsec,
@@ -1140,7 +1135,7 @@ arch_apply_relocation(struct obj_file *f,
1140 return ret; 1135 return ret;
1141} 1136}
1142 1137
1143int arch_create_got(struct obj_file *f) 1138static int arch_create_got(struct obj_file *f)
1144{ 1139{
1145#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES) 1140#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
1146 struct arch_file *ifile = (struct arch_file *) f; 1141 struct arch_file *ifile = (struct arch_file *) f;
@@ -1271,7 +1266,7 @@ int arch_create_got(struct obj_file *f)
1271 return 1; 1266 return 1;
1272} 1267}
1273 1268
1274int arch_init_module(struct obj_file *f, struct new_module *mod) 1269static int arch_init_module(struct obj_file *f, struct new_module *mod)
1275{ 1270{
1276 return 1; 1271 return 1;
1277} 1272}
@@ -1280,7 +1275,7 @@ int arch_init_module(struct obj_file *f, struct new_module *mod)
1280/*======================================================================*/ 1275/*======================================================================*/
1281 1276
1282/* Standard ELF hash function. */ 1277/* Standard ELF hash function. */
1283inline unsigned long obj_elf_hash_n(const char *name, unsigned long n) 1278static inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
1284{ 1279{
1285 unsigned long h = 0; 1280 unsigned long h = 0;
1286 unsigned long g; 1281 unsigned long g;
@@ -1298,7 +1293,7 @@ inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
1298 return h; 1293 return h;
1299} 1294}
1300 1295
1301unsigned long obj_elf_hash(const char *name) 1296static unsigned long obj_elf_hash(const char *name)
1302{ 1297{
1303 return obj_elf_hash_n(name, strlen(name)); 1298 return obj_elf_hash_n(name, strlen(name));
1304} 1299}
@@ -1309,25 +1304,15 @@ unsigned long obj_elf_hash(const char *name)
1309static int get_kernel_version(char str[STRVERSIONLEN]) 1304static int get_kernel_version(char str[STRVERSIONLEN])
1310{ 1305{
1311 struct utsname uts_info; 1306 struct utsname uts_info;
1312 char *p, *q; 1307 int kv;
1313 int a, b, c;
1314 1308
1315 if (uname(&uts_info) < 0) 1309 if (uname(&uts_info) < 0)
1316 return -1; 1310 return -1;
1317 strncpy(str, uts_info.release, STRVERSIONLEN); 1311 strncpy(str, uts_info.release, STRVERSIONLEN);
1318 p = uts_info.release;
1319 1312
1320 a = strtoul(p, &p, 10); 1313 kv = get_kernel_revision();
1321 if (*p != '.') 1314 if(kv==0)
1322 return -1;
1323 b = strtoul(p + 1, &p, 10);
1324 if (*p != '.')
1325 return -1; 1315 return -1;
1326 c = strtoul(p + 1, &q, 10);
1327 if (p + 1 == q)
1328 return -1;
1329
1330 return a << 16 | b << 8 | c;
1331} 1316}
1332 1317
1333/* String comparison for non-co-versioned kernel and module. */ 1318/* String comparison for non-co-versioned kernel and module. */
@@ -1355,7 +1340,7 @@ static unsigned long ncv_symbol_hash(const char *str)
1355 return obj_elf_hash_n(str, len); 1340 return obj_elf_hash_n(str, len);
1356} 1341}
1357 1342
1358void 1343static void
1359obj_set_symbol_compare(struct obj_file *f, 1344obj_set_symbol_compare(struct obj_file *f,
1360 int (*cmp) (const char *, const char *), 1345 int (*cmp) (const char *, const char *),
1361 unsigned long (*hash) (const char *)) 1346 unsigned long (*hash) (const char *))
@@ -1383,8 +1368,8 @@ obj_set_symbol_compare(struct obj_file *f,
1383 1368
1384#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ 1369#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
1385 1370
1386 1371static struct obj_symbol *
1387struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, 1372obj_add_symbol(struct obj_file *f, const char *name,
1388 unsigned long symidx, int info, 1373 unsigned long symidx, int info,
1389 int secidx, ElfW(Addr) value, 1374 int secidx, ElfW(Addr) value,
1390 unsigned long size) 1375 unsigned long size)
@@ -1478,7 +1463,8 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
1478 return sym; 1463 return sym;
1479} 1464}
1480 1465
1481struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name) 1466static struct obj_symbol *
1467obj_find_symbol(struct obj_file *f, const char *name)
1482{ 1468{
1483 struct obj_symbol *sym; 1469 struct obj_symbol *sym;
1484 unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS; 1470 unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS;
@@ -1490,7 +1476,7 @@ struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
1490 return NULL; 1476 return NULL;
1491} 1477}
1492 1478
1493ElfW(Addr) 1479static ElfW(Addr)
1494 obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym) 1480 obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym)
1495{ 1481{
1496 if (sym) { 1482 if (sym) {
@@ -1504,7 +1490,7 @@ ElfW(Addr)
1504 } 1490 }
1505} 1491}
1506 1492
1507struct obj_section *obj_find_section(struct obj_file *f, const char *name) 1493static struct obj_section *obj_find_section(struct obj_file *f, const char *name)
1508{ 1494{
1509 int i, n = f->header.e_shnum; 1495 int i, n = f->header.e_shnum;
1510 1496
@@ -1537,7 +1523,7 @@ static int obj_load_order_prio(struct obj_section *a)
1537 return ac; 1523 return ac;
1538} 1524}
1539 1525
1540void 1526static void
1541obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec) 1527obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
1542{ 1528{
1543 struct obj_section **p; 1529 struct obj_section **p;
@@ -1549,7 +1535,7 @@ obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
1549 *p = sec; 1535 *p = sec;
1550} 1536}
1551 1537
1552struct obj_section *obj_create_alloced_section(struct obj_file *f, 1538static struct obj_section *obj_create_alloced_section(struct obj_file *f,
1553 const char *name, 1539 const char *name,
1554 unsigned long align, 1540 unsigned long align,
1555 unsigned long size) 1541 unsigned long size)
@@ -1575,7 +1561,7 @@ struct obj_section *obj_create_alloced_section(struct obj_file *f,
1575 return sec; 1561 return sec;
1576} 1562}
1577 1563
1578struct obj_section *obj_create_alloced_section_first(struct obj_file *f, 1564static struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
1579 const char *name, 1565 const char *name,
1580 unsigned long align, 1566 unsigned long align,
1581 unsigned long size) 1567 unsigned long size)
@@ -1604,7 +1590,7 @@ struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
1604 return sec; 1590 return sec;
1605} 1591}
1606 1592
1607void *obj_extend_section(struct obj_section *sec, unsigned long more) 1593static void *obj_extend_section(struct obj_section *sec, unsigned long more)
1608{ 1594{
1609 unsigned long oldsize = sec->header.sh_size; 1595 unsigned long oldsize = sec->header.sh_size;
1610 if (more) { 1596 if (more) {
@@ -1614,7 +1600,6 @@ void *obj_extend_section(struct obj_section *sec, unsigned long more)
1614} 1600}
1615 1601
1616 1602
1617
1618/* Conditionally add the symbols from the given symbol set to the 1603/* Conditionally add the symbols from the given symbol set to the
1619 new module. */ 1604 new module. */
1620 1605
@@ -2631,7 +2616,7 @@ new_init_module(const char *m_name, struct obj_file *f,
2631 2616
2632/*======================================================================*/ 2617/*======================================================================*/
2633 2618
2634int 2619static int
2635obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, 2620obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
2636 const char *string) 2621 const char *string)
2637{ 2622{
@@ -2660,7 +2645,7 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
2660 return 1; 2645 return 1;
2661} 2646}
2662 2647
2663int 2648static int
2664obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, 2649obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
2665 struct obj_symbol *sym) 2650 struct obj_symbol *sym)
2666{ 2651{
@@ -2676,7 +2661,7 @@ obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
2676 return 1; 2661 return 1;
2677} 2662}
2678 2663
2679int obj_check_undefineds(struct obj_file *f) 2664static int obj_check_undefineds(struct obj_file *f)
2680{ 2665{
2681 unsigned long i; 2666 unsigned long i;
2682 int ret = 1; 2667 int ret = 1;
@@ -2698,7 +2683,7 @@ int obj_check_undefineds(struct obj_file *f)
2698 return ret; 2683 return ret;
2699} 2684}
2700 2685
2701void obj_allocate_commons(struct obj_file *f) 2686static void obj_allocate_commons(struct obj_file *f)
2702{ 2687{
2703 struct common_entry { 2688 struct common_entry {
2704 struct common_entry *next; 2689 struct common_entry *next;
@@ -2807,7 +2792,7 @@ void obj_allocate_commons(struct obj_file *f)
2807 } 2792 }
2808} 2793}
2809 2794
2810unsigned long obj_load_size(struct obj_file *f) 2795static unsigned long obj_load_size(struct obj_file *f)
2811{ 2796{
2812 unsigned long dot = 0; 2797 unsigned long dot = 0;
2813 struct obj_section *sec; 2798 struct obj_section *sec;
@@ -2828,7 +2813,7 @@ unsigned long obj_load_size(struct obj_file *f)
2828 return dot; 2813 return dot;
2829} 2814}
2830 2815
2831int obj_relocate(struct obj_file *f, ElfW(Addr) base) 2816static int obj_relocate(struct obj_file *f, ElfW(Addr) base)
2832{ 2817{
2833 int i, n = f->header.e_shnum; 2818 int i, n = f->header.e_shnum;
2834 int ret = 1; 2819 int ret = 1;
@@ -2958,7 +2943,7 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
2958 return ret; 2943 return ret;
2959} 2944}
2960 2945
2961int obj_create_image(struct obj_file *f, char *image) 2946static int obj_create_image(struct obj_file *f, char *image)
2962{ 2947{
2963 struct obj_section *sec; 2948 struct obj_section *sec;
2964 ElfW(Addr) base = f->baseaddr; 2949 ElfW(Addr) base = f->baseaddr;
@@ -2980,7 +2965,7 @@ int obj_create_image(struct obj_file *f, char *image)
2980 2965
2981/*======================================================================*/ 2966/*======================================================================*/
2982 2967
2983struct obj_file *obj_load(FILE * fp, int loadprogbits) 2968static struct obj_file *obj_load(FILE * fp, int loadprogbits)
2984{ 2969{
2985 struct obj_file *f; 2970 struct obj_file *f;
2986 ElfW(Shdr) * section_headers; 2971 ElfW(Shdr) * section_headers;
@@ -3186,7 +3171,7 @@ struct obj_file *obj_load(FILE * fp, int loadprogbits)
3186 * kernel for the module 3171 * kernel for the module
3187 */ 3172 */
3188 3173
3189int obj_load_progbits(FILE * fp, struct obj_file* f) 3174static int obj_load_progbits(FILE * fp, struct obj_file* f)
3190{ 3175{
3191 char* imagebase = (char*) f->imagebase; 3176 char* imagebase = (char*) f->imagebase;
3192 ElfW(Addr) base = f->baseaddr; 3177 ElfW(Addr) base = f->baseaddr;
diff --git a/mount.c b/mount.c
index 9c438bf6c..eb6091f30 100644
--- a/mount.c
+++ b/mount.c
@@ -233,7 +233,7 @@ parse_mount_options(char *options, int *flags, char *strflags)
233 } 233 }
234} 234}
235 235
236extern int 236static int
237mount_one(char *blockDevice, char *directory, char *filesystemType, 237mount_one(char *blockDevice, char *directory, char *filesystemType,
238 unsigned long flags, char *string_flags, int useMtab, int fakeIt, 238 unsigned long flags, char *string_flags, int useMtab, int fakeIt,
239 char *mtab_opts, int whineOnErrors, int mount_all) 239 char *mtab_opts, int whineOnErrors, int mount_all)
diff --git a/networking/ping.c b/networking/ping.c
index 620a29dc9..5ca5dd9e0 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.45 2001/07/13 20:56:27 kraai Exp $ 3 * $Id: ping.c,v 1.46 2001/07/17 01:12:36 andersen Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -430,7 +430,6 @@ static void ping(const char *host)
430 if (h->h_addrtype != AF_INET) 430 if (h->h_addrtype != AF_INET)
431 error_msg_and_die("unknown address type; only AF_INET is currently supported."); 431 error_msg_and_die("unknown address type; only AF_INET is currently supported.");
432 432
433 pingaddr.sin_family = AF_INET; /* h->h_addrtype */
434 memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); 433 memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
435 strncpy(buf, h->h_name, sizeof(buf) - 1); 434 strncpy(buf, h->h_name, sizeof(buf) - 1);
436 hostname = buf; 435 hostname = buf;
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 106cf043b..a3af5f698 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -131,40 +131,38 @@ static int nflag; /* print addresses numerically */
131 * If the nflag has been supplied, give 131 * If the nflag has been supplied, give
132 * numeric value, otherwise try for symbolic name. 132 * numeric value, otherwise try for symbolic name.
133 */ 133 */
134static inline char * 134static inline void
135inetname(struct in_addr in) 135inetname(struct sockaddr_in *from)
136{ 136{
137 char *cp; 137 char *cp;
138 static char line[50];
139 struct hostent *hp; 138 struct hostent *hp;
140 static char domain[MAXHOSTNAMELEN + 1]; 139 static char domain[MAXHOSTNAMELEN + 1];
141 static int first = 1; 140 static int first = 1;
141 const char *ina;
142 142
143 if (first && !nflag) { 143 if (first && !nflag) {
144 first = 0; 144 first = 0;
145 if (gethostname(domain, MAXHOSTNAMELEN) == 0 && 145 if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
146 (cp = index(domain, '.'))) 146 (cp = strchr(domain, '.')))
147 (void) strcpy(domain, cp + 1); 147 (void) strcpy(domain, cp + 1);
148 else 148 else
149 domain[0] = 0; 149 domain[0] = 0;
150 } 150 }
151 cp = 0; 151 cp = 0;
152 if (!nflag && in.s_addr != INADDR_ANY) { 152 if (!nflag && from->sin_addr.s_addr != INADDR_ANY) {
153 hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET); 153 hp = gethostbyaddr((char *)&(from->sin_addr), sizeof (from->sin_addr), AF_INET);
154 if (hp) { 154 if (hp) {
155 if ((cp = index(hp->h_name, '.')) && 155 if ((cp = strchr(hp->h_name, '.')) &&
156 !strcmp(cp + 1, domain)) 156 !strcmp(cp + 1, domain))
157 *cp = 0; 157 *cp = 0;
158 cp = (char *)hp->h_name; 158 cp = (char *)hp->h_name;
159 } 159 }
160 } 160 }
161 if (cp) 161 ina = inet_ntoa(from->sin_addr);
162 (void) strcpy(line, cp); 162 if (nflag)
163 else { 163 printf(" %s", ina);
164 in.s_addr = ntohl(in.s_addr); 164 else
165 strcpy(line, inet_ntoa(in)); 165 printf(" %s (%s)", (cp ? cp : ina), ina);
166 }
167 return (line);
168} 166}
169 167
170static inline void 168static inline void
@@ -177,12 +175,7 @@ print(u_char *buf, int cc, struct sockaddr_in *from)
177 hlen = ip->ip_hl << 2; 175 hlen = ip->ip_hl << 2;
178 cc -= hlen; 176 cc -= hlen;
179 177
180 if (nflag) 178 inetname(from);
181 printf(" %s", inet_ntoa(from->sin_addr));
182 else
183 printf(" %s (%s)", inetname(from->sin_addr),
184 inet_ntoa(from->sin_addr));
185
186#ifdef BB_FEATURE_TRACEROUTE_VERBOSE 179#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
187 if (verbose) 180 if (verbose)
188 printf (" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); 181 printf (" %d bytes to %s", cc, inet_ntoa (ip->ip_dst));
diff --git a/ping.c b/ping.c
index 620a29dc9..5ca5dd9e0 100644
--- a/ping.c
+++ b/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.45 2001/07/13 20:56:27 kraai Exp $ 3 * $Id: ping.c,v 1.46 2001/07/17 01:12:36 andersen Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -430,7 +430,6 @@ static void ping(const char *host)
430 if (h->h_addrtype != AF_INET) 430 if (h->h_addrtype != AF_INET)
431 error_msg_and_die("unknown address type; only AF_INET is currently supported."); 431 error_msg_and_die("unknown address type; only AF_INET is currently supported.");
432 432
433 pingaddr.sin_family = AF_INET; /* h->h_addrtype */
434 memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); 433 memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
435 strncpy(buf, h->h_name, sizeof(buf) - 1); 434 strncpy(buf, h->h_name, sizeof(buf) - 1);
436 hostname = buf; 435 hostname = buf;
diff --git a/shell/ash.c b/shell/ash.c
index 334d2fddd..d16da82db 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -6204,8 +6204,7 @@ retry:
6204 if (!iflag) 6204 if (!iflag)
6205 nr = safe_read(parsefile->fd, buf, BUFSIZ - 1); 6205 nr = safe_read(parsefile->fd, buf, BUFSIZ - 1);
6206 else { 6206 else {
6207 cmdedit_read_input((char*)cmdedit_prompt, buf); 6207 nr = cmdedit_read_input((char*)cmdedit_prompt, buf);
6208 nr = strlen(buf);
6209 } 6208 }
6210 } 6209 }
6211#else 6210#else
@@ -9445,7 +9444,7 @@ static char *wordtext; /* text of last word returned by readtok
9445 9444
9446static struct nodelist *backquotelist; 9445static struct nodelist *backquotelist;
9447static union node *redirnode; 9446static union node *redirnode;
9448struct heredoc *heredoc; 9447static struct heredoc *heredoc;
9449static int quoteflag; /* set if (part of) last token was quoted */ 9448static int quoteflag; /* set if (part of) last token was quoted */
9450static int startlinno; /* line # where last token started */ 9449static int startlinno; /* line # where last token started */
9451 9450
@@ -12917,7 +12916,7 @@ findvar(struct var **vpp, const char *name)
12917/* 12916/*
12918 * Copyright (c) 1999 Herbert Xu <herbert@debian.org> 12917 * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
12919 * This file contains code for the times builtin. 12918 * This file contains code for the times builtin.
12920 * $Id: ash.c,v 1.10 2001/07/12 20:26:31 andersen Exp $ 12919 * $Id: ash.c,v 1.11 2001/07/17 01:12:35 andersen Exp $
12921 */ 12920 */
12922static int timescmd (int argc, char **argv) 12921static int timescmd (int argc, char **argv)
12923{ 12922{
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 540eb7ea7..69f833747 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -1153,7 +1153,8 @@ enum {
1153 * 1153 *
1154 */ 1154 */
1155 1155
1156extern void cmdedit_read_input(char *prompt, char command[BUFSIZ]) 1156
1157int cmdedit_read_input(char *prompt, char command[BUFSIZ])
1157{ 1158{
1158 1159
1159 int break_out = 0; 1160 int break_out = 0;
@@ -1231,10 +1232,15 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
1231 * if the len=0 and no chars to delete */ 1232 * if the len=0 and no chars to delete */
1232 if (len == 0) { 1233 if (len == 0) {
1233prepare_to_die: 1234prepare_to_die:
1235#if !defined(BB_FEATURE_ASH)
1234 printf("exit"); 1236 printf("exit");
1235 goto_new_line(); 1237 goto_new_line();
1236 /* cmdedit_reset_term() called in atexit */ 1238 /* cmdedit_reset_term() called in atexit */
1237 exit(EXIT_SUCCESS); 1239 exit(EXIT_SUCCESS);
1240#else
1241 break_out = -1; /* for control stoped jobs */
1242 break;
1243#endif
1238 } else { 1244 } else {
1239 input_delete(); 1245 input_delete();
1240 } 1246 }
@@ -1455,8 +1461,10 @@ prepare_to_die:
1455 num_ok_lines++; 1461 num_ok_lines++;
1456#endif 1462#endif
1457 } 1463 }
1464 if(break_out>0) {
1458 command[len++] = '\n'; /* set '\n' */ 1465 command[len++] = '\n'; /* set '\n' */
1459 command[len] = 0; 1466 command[len] = 0;
1467 }
1460#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) 1468#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
1461 input_tab(0); /* strong free */ 1469 input_tab(0); /* strong free */
1462#endif 1470#endif
@@ -1464,6 +1472,7 @@ prepare_to_die:
1464 free(cmdedit_prompt); 1472 free(cmdedit_prompt);
1465#endif 1473#endif
1466 cmdedit_reset_term(); 1474 cmdedit_reset_term();
1475 return len;
1467} 1476}
1468 1477
1469 1478
diff --git a/shell/cmdedit.h b/shell/cmdedit.h
index 1482da3b8..83893572a 100644
--- a/shell/cmdedit.h
+++ b/shell/cmdedit.h
@@ -1,6 +1,6 @@
1#ifndef CMDEDIT_H 1#ifndef CMDEDIT_H
2#define CMDEDIT_H 2#define CMDEDIT_H
3 3
4void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */ 4int cmdedit_read_input(char* promptStr, char* command);
5 5
6#endif /* CMDEDIT_H */ 6#endif /* CMDEDIT_H */
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index d334c50c9..8ae70a1ed 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -346,7 +346,7 @@ static const int IOV_COUNT = 2;
346 struct iovec iov[IOV_COUNT]; 346 struct iovec iov[IOV_COUNT];
347 struct iovec *v = iov; 347 struct iovec *v = iov;
348 348
349 bzero(&res, sizeof(res)); 349 memset(&res, 0, sizeof(res));
350 snprintf(res, sizeof(res), "<%d>", pri); 350 snprintf(res, sizeof(res), "<%d>", pri);
351 v->iov_base = res ; 351 v->iov_base = res ;
352 v->iov_len = strlen(res); 352 v->iov_len = strlen(res);
@@ -442,7 +442,7 @@ static void init_RemoteLog (void){
442 struct hostent *hostinfo; 442 struct hostent *hostinfo;
443 int len = sizeof(remoteaddr); 443 int len = sizeof(remoteaddr);
444 444
445 bzero(&remoteaddr, len); 445 memset(&remoteaddr, 0, len);
446 446
447 remotefd = socket(AF_INET, SOCK_DGRAM, 0); 447 remotefd = socket(AF_INET, SOCK_DGRAM, 0);
448 448
diff --git a/syslogd.c b/syslogd.c
index d334c50c9..8ae70a1ed 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -346,7 +346,7 @@ static const int IOV_COUNT = 2;
346 struct iovec iov[IOV_COUNT]; 346 struct iovec iov[IOV_COUNT];
347 struct iovec *v = iov; 347 struct iovec *v = iov;
348 348
349 bzero(&res, sizeof(res)); 349 memset(&res, 0, sizeof(res));
350 snprintf(res, sizeof(res), "<%d>", pri); 350 snprintf(res, sizeof(res), "<%d>", pri);
351 v->iov_base = res ; 351 v->iov_base = res ;
352 v->iov_len = strlen(res); 352 v->iov_len = strlen(res);
@@ -442,7 +442,7 @@ static void init_RemoteLog (void){
442 struct hostent *hostinfo; 442 struct hostent *hostinfo;
443 int len = sizeof(remoteaddr); 443 int len = sizeof(remoteaddr);
444 444
445 bzero(&remoteaddr, len); 445 memset(&remoteaddr, 0, len);
446 446
447 remotefd = socket(AF_INET, SOCK_DGRAM, 0); 447 remotefd = socket(AF_INET, SOCK_DGRAM, 0);
448 448
diff --git a/traceroute.c b/traceroute.c
index 106cf043b..a3af5f698 100644
--- a/traceroute.c
+++ b/traceroute.c
@@ -131,40 +131,38 @@ static int nflag; /* print addresses numerically */
131 * If the nflag has been supplied, give 131 * If the nflag has been supplied, give
132 * numeric value, otherwise try for symbolic name. 132 * numeric value, otherwise try for symbolic name.
133 */ 133 */
134static inline char * 134static inline void
135inetname(struct in_addr in) 135inetname(struct sockaddr_in *from)
136{ 136{
137 char *cp; 137 char *cp;
138 static char line[50];
139 struct hostent *hp; 138 struct hostent *hp;
140 static char domain[MAXHOSTNAMELEN + 1]; 139 static char domain[MAXHOSTNAMELEN + 1];
141 static int first = 1; 140 static int first = 1;
141 const char *ina;
142 142
143 if (first && !nflag) { 143 if (first && !nflag) {
144 first = 0; 144 first = 0;
145 if (gethostname(domain, MAXHOSTNAMELEN) == 0 && 145 if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
146 (cp = index(domain, '.'))) 146 (cp = strchr(domain, '.')))
147 (void) strcpy(domain, cp + 1); 147 (void) strcpy(domain, cp + 1);
148 else 148 else
149 domain[0] = 0; 149 domain[0] = 0;
150 } 150 }
151 cp = 0; 151 cp = 0;
152 if (!nflag && in.s_addr != INADDR_ANY) { 152 if (!nflag && from->sin_addr.s_addr != INADDR_ANY) {
153 hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET); 153 hp = gethostbyaddr((char *)&(from->sin_addr), sizeof (from->sin_addr), AF_INET);
154 if (hp) { 154 if (hp) {
155 if ((cp = index(hp->h_name, '.')) && 155 if ((cp = strchr(hp->h_name, '.')) &&
156 !strcmp(cp + 1, domain)) 156 !strcmp(cp + 1, domain))
157 *cp = 0; 157 *cp = 0;
158 cp = (char *)hp->h_name; 158 cp = (char *)hp->h_name;
159 } 159 }
160 } 160 }
161 if (cp) 161 ina = inet_ntoa(from->sin_addr);
162 (void) strcpy(line, cp); 162 if (nflag)
163 else { 163 printf(" %s", ina);
164 in.s_addr = ntohl(in.s_addr); 164 else
165 strcpy(line, inet_ntoa(in)); 165 printf(" %s (%s)", (cp ? cp : ina), ina);
166 }
167 return (line);
168} 166}
169 167
170static inline void 168static inline void
@@ -177,12 +175,7 @@ print(u_char *buf, int cc, struct sockaddr_in *from)
177 hlen = ip->ip_hl << 2; 175 hlen = ip->ip_hl << 2;
178 cc -= hlen; 176 cc -= hlen;
179 177
180 if (nflag) 178 inetname(from);
181 printf(" %s", inet_ntoa(from->sin_addr));
182 else
183 printf(" %s (%s)", inetname(from->sin_addr),
184 inet_ntoa(from->sin_addr));
185
186#ifdef BB_FEATURE_TRACEROUTE_VERBOSE 179#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
187 if (verbose) 180 if (verbose)
188 printf (" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); 181 printf (" %d bytes to %s", cc, inet_ntoa (ip->ip_dst));
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 9c438bf6c..eb6091f30 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -233,7 +233,7 @@ parse_mount_options(char *options, int *flags, char *strflags)
233 } 233 }
234} 234}
235 235
236extern int 236static int
237mount_one(char *blockDevice, char *directory, char *filesystemType, 237mount_one(char *blockDevice, char *directory, char *filesystemType,
238 unsigned long flags, char *string_flags, int useMtab, int fakeIt, 238 unsigned long flags, char *string_flags, int useMtab, int fakeIt,
239 char *mtab_opts, int whineOnErrors, int mount_all) 239 char *mtab_opts, int whineOnErrors, int mount_all)
diff --git a/vi.c b/vi.c
index 9e3355685..f75c884eb 100644
--- a/vi.c
+++ b/vi.c
@@ -18,8 +18,8 @@
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 19 */
20 20
21char *vi_Version = 21static const char vi_Version[] =
22 "$Id: vi.c,v 1.11 2001/07/02 18:06:14 andersen Exp $"; 22 "$Id: vi.c,v 1.12 2001/07/17 01:12:36 andersen Exp $";
23 23
24/* 24/*
25 * To compile for standalone use: 25 * To compile for standalone use: