summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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[] = {
#include <string.h>
#include "libbb.h"
-FILE *in_file, *out_file;
+static FILE *in_file, *out_file;
/* these are freed by gz_close */
static unsigned char *window;
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
static long bytes_out; /* number of output bytes */
static unsigned long outcnt; /* bytes in output buffer */
-unsigned hufts; /* track memory usage */
-unsigned long bb; /* bit buffer */
-unsigned bk; /* bits in bit buffer */
+static unsigned hufts; /* track memory usage */
+static unsigned long bb; /* bit buffer */
+static unsigned bk; /* bits in bit buffer */
typedef struct huft_s {
unsigned char e; /* number of extra bits or operation */
@@ -104,7 +104,7 @@ typedef struct huft_s {
} v;
} huft_t;
-unsigned short mask_bits[] = {
+static const unsigned short mask_bits[] = {
0x0000,
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -154,7 +154,7 @@ static void make_crc_table()
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
* (Used for the decompressed data only.)
*/
-void flush_window()
+static void flush_window(void)
{
int n;
@@ -1021,10 +1021,6 @@ extern void gz_close(int gunzip_pid)
if (waitpid(gunzip_pid, NULL, 0) == -1) {
printf("Couldnt wait ?");
}
- if (window) {
free(window);
- }
- if (crc_table) {
free(crc_table);
- }
}
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[] = {
#include <string.h>
#include "libbb.h"
-FILE *in_file, *out_file;
+static FILE *in_file, *out_file;
/* these are freed by gz_close */
static unsigned char *window;
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
static long bytes_out; /* number of output bytes */
static unsigned long outcnt; /* bytes in output buffer */
-unsigned hufts; /* track memory usage */
-unsigned long bb; /* bit buffer */
-unsigned bk; /* bits in bit buffer */
+static unsigned hufts; /* track memory usage */
+static unsigned long bb; /* bit buffer */
+static unsigned bk; /* bits in bit buffer */
typedef struct huft_s {
unsigned char e; /* number of extra bits or operation */
@@ -104,7 +104,7 @@ typedef struct huft_s {
} v;
} huft_t;
-unsigned short mask_bits[] = {
+static const unsigned short mask_bits[] = {
0x0000,
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -154,7 +154,7 @@ static void make_crc_table()
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
* (Used for the decompressed data only.)
*/
-void flush_window()
+static void flush_window(void)
{
int n;
@@ -1021,10 +1021,6 @@ extern void gz_close(int gunzip_pid)
if (waitpid(gunzip_pid, NULL, 0) == -1) {
printf("Couldnt wait ?");
}
- if (window) {
free(window);
- }
- if (crc_table) {
free(crc_table);
- }
}
diff --git a/ash.c b/ash.c
index 334d2fddd..d16da82db 100644
--- a/ash.c
+++ b/ash.c
@@ -6204,8 +6204,7 @@ retry:
if (!iflag)
nr = safe_read(parsefile->fd, buf, BUFSIZ - 1);
else {
- cmdedit_read_input((char*)cmdedit_prompt, buf);
- nr = strlen(buf);
+ nr = cmdedit_read_input((char*)cmdedit_prompt, buf);
}
}
#else
@@ -9445,7 +9444,7 @@ static char *wordtext; /* text of last word returned by readtok
static struct nodelist *backquotelist;
static union node *redirnode;
-struct heredoc *heredoc;
+static struct heredoc *heredoc;
static int quoteflag; /* set if (part of) last token was quoted */
static int startlinno; /* line # where last token started */
@@ -12917,7 +12916,7 @@ findvar(struct var **vpp, const char *name)
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin.
- * $Id: ash.c,v 1.10 2001/07/12 20:26:31 andersen Exp $
+ * $Id: ash.c,v 1.11 2001/07/17 01:12:35 andersen Exp $
*/
static int timescmd (int argc, char **argv)
{
diff --git a/cmdedit.c b/cmdedit.c
index 540eb7ea7..69f833747 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -1153,7 +1153,8 @@ enum {
*
*/
-extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
+
+int cmdedit_read_input(char *prompt, char command[BUFSIZ])
{
int break_out = 0;
@@ -1231,10 +1232,15 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
* if the len=0 and no chars to delete */
if (len == 0) {
prepare_to_die:
+#if !defined(BB_FEATURE_ASH)
printf("exit");
goto_new_line();
/* cmdedit_reset_term() called in atexit */
exit(EXIT_SUCCESS);
+#else
+ break_out = -1; /* for control stoped jobs */
+ break;
+#endif
} else {
input_delete();
}
@@ -1455,8 +1461,10 @@ prepare_to_die:
num_ok_lines++;
#endif
}
+ if(break_out>0) {
command[len++] = '\n'; /* set '\n' */
command[len] = 0;
+ }
#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
input_tab(0); /* strong free */
#endif
@@ -1464,6 +1472,7 @@ prepare_to_die:
free(cmdedit_prompt);
#endif
cmdedit_reset_term();
+ return len;
}
diff --git a/cmdedit.h b/cmdedit.h
index 1482da3b8..83893572a 100644
--- a/cmdedit.h
+++ b/cmdedit.h
@@ -1,6 +1,6 @@
#ifndef CMDEDIT_H
#define CMDEDIT_H
-void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */
+int cmdedit_read_input(char* promptStr, char* command);
#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 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-char *vi_Version =
- "$Id: vi.c,v 1.11 2001/07/02 18:06:14 andersen Exp $";
+static const char vi_Version[] =
+ "$Id: vi.c,v 1.12 2001/07/17 01:12:36 andersen Exp $";
/*
* 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 @@
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
+#ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -347,7 +347,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
+#ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -537,78 +537,73 @@ struct obj_symbol_patch
/* Generic object manipulation routines. */
-unsigned long obj_elf_hash(const char *);
+static unsigned long obj_elf_hash(const char *);
-unsigned long obj_elf_hash_n(const char *, unsigned long len);
+static unsigned long obj_elf_hash_n(const char *, unsigned long len);
-struct obj_symbol *obj_add_symbol (struct obj_file *f, const char *name,
- unsigned long symidx, int info, int secidx,
- ElfW(Addr) value, unsigned long size);
-
-struct obj_symbol *obj_find_symbol (struct obj_file *f,
+static struct obj_symbol *obj_find_symbol (struct obj_file *f,
const char *name);
-ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
+static ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
struct obj_symbol *sym);
-void obj_set_symbol_compare(struct obj_file *f,
+static void obj_set_symbol_compare(struct obj_file *f,
int (*cmp)(const char *, const char *),
unsigned long (*hash)(const char *));
-struct obj_section *obj_find_section (struct obj_file *f,
+static struct obj_section *obj_find_section (struct obj_file *f,
const char *name);
-void obj_insert_section_load_order (struct obj_file *f,
+static void obj_insert_section_load_order (struct obj_file *f,
struct obj_section *sec);
-struct obj_section *obj_create_alloced_section (struct obj_file *f,
+static struct obj_section *obj_create_alloced_section (struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size);
-struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
+static struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size);
-void *obj_extend_section (struct obj_section *sec, unsigned long more);
+static void *obj_extend_section (struct obj_section *sec, unsigned long more);
-int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
+static int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
const char *string);
-int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
+static int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
struct obj_symbol *sym);
-int obj_check_undefineds(struct obj_file *f);
+static int obj_check_undefineds(struct obj_file *f);
-void obj_allocate_commons(struct obj_file *f);
+static void obj_allocate_commons(struct obj_file *f);
-unsigned long obj_load_size (struct obj_file *f);
+static unsigned long obj_load_size (struct obj_file *f);
-int obj_relocate (struct obj_file *f, ElfW(Addr) base);
+static int obj_relocate (struct obj_file *f, ElfW(Addr) base);
-struct obj_file *obj_load(FILE *f, int loadprogbits);
+static struct obj_file *obj_load(FILE *f, int loadprogbits);
-int obj_create_image (struct obj_file *f, char *image);
+static int obj_create_image (struct obj_file *f, char *image);
/* Architecture specific manipulation routines. */
-struct obj_file *arch_new_file (void);
+static struct obj_file *arch_new_file (void);
-struct obj_section *arch_new_section (void);
+static struct obj_section *arch_new_section (void);
-struct obj_symbol *arch_new_symbol (void);
+static struct obj_symbol *arch_new_symbol (void);
-enum obj_reloc arch_apply_relocation (struct obj_file *f,
+static enum obj_reloc arch_apply_relocation (struct obj_file *f,
struct obj_section *targsec,
struct obj_section *symsec,
struct obj_symbol *sym,
ElfW(RelM) *rel, ElfW(Addr) value);
-int arch_create_got (struct obj_file *f);
+static int arch_create_got (struct obj_file *f);
-struct new_module;
-int arch_init_module (struct obj_file *f, struct new_module *);
+static int arch_init_module (struct obj_file *f, struct new_module *);
#endif /* obj.h */
//----------------------------------------------------------------------------
@@ -624,10 +619,10 @@ static const int STRVERSIONLEN = 32;
/*======================================================================*/
-int flag_force_load = 0;
-int flag_autoclean = 0;
-int flag_verbose = 0;
-int flag_export = 1;
+static int flag_force_load = 0;
+static int flag_autoclean = 0;
+static int flag_verbose = 0;
+static int flag_export = 1;
/*======================================================================*/
@@ -700,12 +695,12 @@ struct external_module {
struct new_module_symbol *syms;
};
-struct new_module_symbol *ksyms;
-size_t nksyms;
+static struct new_module_symbol *ksyms;
+static size_t nksyms;
-struct external_module *ext_modules;
-int n_ext_modules;
-int n_ext_modules_used;
+static struct external_module *ext_modules;
+static int n_ext_modules;
+static int n_ext_modules_used;
extern int delete_module(const char *);
static char m_filename[FILENAME_MAX + 1];
@@ -740,7 +735,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
/*======================================================================*/
-struct obj_file *arch_new_file(void)
+static struct obj_file *arch_new_file(void)
{
struct arch_file *f;
f = xmalloc(sizeof(*f));
@@ -758,12 +753,12 @@ struct obj_file *arch_new_file(void)
return &f->root;
}
-struct obj_section *arch_new_section(void)
+static struct obj_section *arch_new_section(void)
{
return xmalloc(sizeof(struct obj_section));
}
-struct obj_symbol *arch_new_symbol(void)
+static struct obj_symbol *arch_new_symbol(void)
{
struct arch_symbol *sym;
sym = xmalloc(sizeof(*sym));
@@ -778,7 +773,7 @@ struct obj_symbol *arch_new_symbol(void)
return &sym->root;
}
-enum obj_reloc
+static enum obj_reloc
arch_apply_relocation(struct obj_file *f,
struct obj_section *targsec,
struct obj_section *symsec,
@@ -1140,7 +1135,7 @@ arch_apply_relocation(struct obj_file *f,
return ret;
}
-int arch_create_got(struct obj_file *f)
+static int arch_create_got(struct obj_file *f)
{
#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
struct arch_file *ifile = (struct arch_file *) f;
@@ -1271,7 +1266,7 @@ int arch_create_got(struct obj_file *f)
return 1;
}
-int arch_init_module(struct obj_file *f, struct new_module *mod)
+static int arch_init_module(struct obj_file *f, struct new_module *mod)
{
return 1;
}
@@ -1280,7 +1275,7 @@ int arch_init_module(struct obj_file *f, struct new_module *mod)
/*======================================================================*/
/* Standard ELF hash function. */
-inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
+static inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
{
unsigned long h = 0;
unsigned long g;
@@ -1298,7 +1293,7 @@ inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
return h;
}
-unsigned long obj_elf_hash(const char *name)
+static unsigned long obj_elf_hash(const char *name)
{
return obj_elf_hash_n(name, strlen(name));
}
@@ -1309,25 +1304,15 @@ unsigned long obj_elf_hash(const char *name)
static int get_kernel_version(char str[STRVERSIONLEN])
{
struct utsname uts_info;
- char *p, *q;
- int a, b, c;
+ int kv;
if (uname(&uts_info) < 0)
return -1;
strncpy(str, uts_info.release, STRVERSIONLEN);
- p = uts_info.release;
- a = strtoul(p, &p, 10);
- if (*p != '.')
- return -1;
- b = strtoul(p + 1, &p, 10);
- if (*p != '.')
+ kv = get_kernel_revision();
+ if(kv==0)
return -1;
- c = strtoul(p + 1, &q, 10);
- if (p + 1 == q)
- return -1;
-
- return a << 16 | b << 8 | c;
}
/* String comparison for non-co-versioned kernel and module. */
@@ -1355,7 +1340,7 @@ static unsigned long ncv_symbol_hash(const char *str)
return obj_elf_hash_n(str, len);
}
-void
+static void
obj_set_symbol_compare(struct obj_file *f,
int (*cmp) (const char *, const char *),
unsigned long (*hash) (const char *))
@@ -1383,8 +1368,8 @@ obj_set_symbol_compare(struct obj_file *f,
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-
-struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
+static struct obj_symbol *
+obj_add_symbol(struct obj_file *f, const char *name,
unsigned long symidx, int info,
int secidx, ElfW(Addr) value,
unsigned long size)
@@ -1478,7 +1463,8 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
return sym;
}
-struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
+static struct obj_symbol *
+obj_find_symbol(struct obj_file *f, const char *name)
{
struct obj_symbol *sym;
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)
return NULL;
}
-ElfW(Addr)
+static ElfW(Addr)
obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym)
{
if (sym) {
@@ -1504,7 +1490,7 @@ ElfW(Addr)
}
}
-struct obj_section *obj_find_section(struct obj_file *f, const char *name)
+static struct obj_section *obj_find_section(struct obj_file *f, const char *name)
{
int i, n = f->header.e_shnum;
@@ -1537,7 +1523,7 @@ static int obj_load_order_prio(struct obj_section *a)
return ac;
}
-void
+static void
obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
{
struct obj_section **p;
@@ -1549,7 +1535,7 @@ obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
*p = sec;
}
-struct obj_section *obj_create_alloced_section(struct obj_file *f,
+static struct obj_section *obj_create_alloced_section(struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size)
@@ -1575,7 +1561,7 @@ struct obj_section *obj_create_alloced_section(struct obj_file *f,
return sec;
}
-struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
+static struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size)
@@ -1604,7 +1590,7 @@ struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
return sec;
}
-void *obj_extend_section(struct obj_section *sec, unsigned long more)
+static void *obj_extend_section(struct obj_section *sec, unsigned long more)
{
unsigned long oldsize = sec->header.sh_size;
if (more) {
@@ -1614,7 +1600,6 @@ void *obj_extend_section(struct obj_section *sec, unsigned long more)
}
-
/* Conditionally add the symbols from the given symbol set to the
new module. */
@@ -2631,7 +2616,7 @@ new_init_module(const char *m_name, struct obj_file *f,
/*======================================================================*/
-int
+static int
obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
const char *string)
{
@@ -2660,7 +2645,7 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
return 1;
}
-int
+static int
obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
struct obj_symbol *sym)
{
@@ -2676,7 +2661,7 @@ obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
return 1;
}
-int obj_check_undefineds(struct obj_file *f)
+static int obj_check_undefineds(struct obj_file *f)
{
unsigned long i;
int ret = 1;
@@ -2698,7 +2683,7 @@ int obj_check_undefineds(struct obj_file *f)
return ret;
}
-void obj_allocate_commons(struct obj_file *f)
+static void obj_allocate_commons(struct obj_file *f)
{
struct common_entry {
struct common_entry *next;
@@ -2807,7 +2792,7 @@ void obj_allocate_commons(struct obj_file *f)
}
}
-unsigned long obj_load_size(struct obj_file *f)
+static unsigned long obj_load_size(struct obj_file *f)
{
unsigned long dot = 0;
struct obj_section *sec;
@@ -2828,7 +2813,7 @@ unsigned long obj_load_size(struct obj_file *f)
return dot;
}
-int obj_relocate(struct obj_file *f, ElfW(Addr) base)
+static int obj_relocate(struct obj_file *f, ElfW(Addr) base)
{
int i, n = f->header.e_shnum;
int ret = 1;
@@ -2958,7 +2943,7 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
return ret;
}
-int obj_create_image(struct obj_file *f, char *image)
+static int obj_create_image(struct obj_file *f, char *image)
{
struct obj_section *sec;
ElfW(Addr) base = f->baseaddr;
@@ -2980,7 +2965,7 @@ int obj_create_image(struct obj_file *f, char *image)
/*======================================================================*/
-struct obj_file *obj_load(FILE * fp, int loadprogbits)
+static struct obj_file *obj_load(FILE * fp, int loadprogbits)
{
struct obj_file *f;
ElfW(Shdr) * section_headers;
@@ -3186,7 +3171,7 @@ struct obj_file *obj_load(FILE * fp, int loadprogbits)
* kernel for the module
*/
-int obj_load_progbits(FILE * fp, struct obj_file* f)
+static int obj_load_progbits(FILE * fp, struct obj_file* f)
{
char* imagebase = (char*) f->imagebase;
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[] = {
#include <string.h>
#include "libbb.h"
-FILE *in_file, *out_file;
+static FILE *in_file, *out_file;
/* these are freed by gz_close */
static unsigned char *window;
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
static long bytes_out; /* number of output bytes */
static unsigned long outcnt; /* bytes in output buffer */
-unsigned hufts; /* track memory usage */
-unsigned long bb; /* bit buffer */
-unsigned bk; /* bits in bit buffer */
+static unsigned hufts; /* track memory usage */
+static unsigned long bb; /* bit buffer */
+static unsigned bk; /* bits in bit buffer */
typedef struct huft_s {
unsigned char e; /* number of extra bits or operation */
@@ -104,7 +104,7 @@ typedef struct huft_s {
} v;
} huft_t;
-unsigned short mask_bits[] = {
+static const unsigned short mask_bits[] = {
0x0000,
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -154,7 +154,7 @@ static void make_crc_table()
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
* (Used for the decompressed data only.)
*/
-void flush_window()
+static void flush_window(void)
{
int n;
@@ -1021,10 +1021,6 @@ extern void gz_close(int gunzip_pid)
if (waitpid(gunzip_pid, NULL, 0) == -1) {
printf("Couldnt wait ?");
}
- if (window) {
free(window);
- }
- if (crc_table) {
free(crc_table);
- }
}
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 @@
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
+#ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -347,7 +347,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
+#ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -537,78 +537,73 @@ struct obj_symbol_patch
/* Generic object manipulation routines. */
-unsigned long obj_elf_hash(const char *);
+static unsigned long obj_elf_hash(const char *);
-unsigned long obj_elf_hash_n(const char *, unsigned long len);
+static unsigned long obj_elf_hash_n(const char *, unsigned long len);
-struct obj_symbol *obj_add_symbol (struct obj_file *f, const char *name,
- unsigned long symidx, int info, int secidx,
- ElfW(Addr) value, unsigned long size);
-
-struct obj_symbol *obj_find_symbol (struct obj_file *f,
+static struct obj_symbol *obj_find_symbol (struct obj_file *f,
const char *name);
-ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
+static ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
struct obj_symbol *sym);
-void obj_set_symbol_compare(struct obj_file *f,
+static void obj_set_symbol_compare(struct obj_file *f,
int (*cmp)(const char *, const char *),
unsigned long (*hash)(const char *));
-struct obj_section *obj_find_section (struct obj_file *f,
+static struct obj_section *obj_find_section (struct obj_file *f,
const char *name);
-void obj_insert_section_load_order (struct obj_file *f,
+static void obj_insert_section_load_order (struct obj_file *f,
struct obj_section *sec);
-struct obj_section *obj_create_alloced_section (struct obj_file *f,
+static struct obj_section *obj_create_alloced_section (struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size);
-struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
+static struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size);
-void *obj_extend_section (struct obj_section *sec, unsigned long more);
+static void *obj_extend_section (struct obj_section *sec, unsigned long more);
-int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
+static int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
const char *string);
-int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
+static int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
struct obj_symbol *sym);
-int obj_check_undefineds(struct obj_file *f);
+static int obj_check_undefineds(struct obj_file *f);
-void obj_allocate_commons(struct obj_file *f);
+static void obj_allocate_commons(struct obj_file *f);
-unsigned long obj_load_size (struct obj_file *f);
+static unsigned long obj_load_size (struct obj_file *f);
-int obj_relocate (struct obj_file *f, ElfW(Addr) base);
+static int obj_relocate (struct obj_file *f, ElfW(Addr) base);
-struct obj_file *obj_load(FILE *f, int loadprogbits);
+static struct obj_file *obj_load(FILE *f, int loadprogbits);
-int obj_create_image (struct obj_file *f, char *image);
+static int obj_create_image (struct obj_file *f, char *image);
/* Architecture specific manipulation routines. */
-struct obj_file *arch_new_file (void);
+static struct obj_file *arch_new_file (void);
-struct obj_section *arch_new_section (void);
+static struct obj_section *arch_new_section (void);
-struct obj_symbol *arch_new_symbol (void);
+static struct obj_symbol *arch_new_symbol (void);
-enum obj_reloc arch_apply_relocation (struct obj_file *f,
+static enum obj_reloc arch_apply_relocation (struct obj_file *f,
struct obj_section *targsec,
struct obj_section *symsec,
struct obj_symbol *sym,
ElfW(RelM) *rel, ElfW(Addr) value);
-int arch_create_got (struct obj_file *f);
+static int arch_create_got (struct obj_file *f);
-struct new_module;
-int arch_init_module (struct obj_file *f, struct new_module *);
+static int arch_init_module (struct obj_file *f, struct new_module *);
#endif /* obj.h */
//----------------------------------------------------------------------------
@@ -624,10 +619,10 @@ static const int STRVERSIONLEN = 32;
/*======================================================================*/
-int flag_force_load = 0;
-int flag_autoclean = 0;
-int flag_verbose = 0;
-int flag_export = 1;
+static int flag_force_load = 0;
+static int flag_autoclean = 0;
+static int flag_verbose = 0;
+static int flag_export = 1;
/*======================================================================*/
@@ -700,12 +695,12 @@ struct external_module {
struct new_module_symbol *syms;
};
-struct new_module_symbol *ksyms;
-size_t nksyms;
+static struct new_module_symbol *ksyms;
+static size_t nksyms;
-struct external_module *ext_modules;
-int n_ext_modules;
-int n_ext_modules_used;
+static struct external_module *ext_modules;
+static int n_ext_modules;
+static int n_ext_modules_used;
extern int delete_module(const char *);
static char m_filename[FILENAME_MAX + 1];
@@ -740,7 +735,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
/*======================================================================*/
-struct obj_file *arch_new_file(void)
+static struct obj_file *arch_new_file(void)
{
struct arch_file *f;
f = xmalloc(sizeof(*f));
@@ -758,12 +753,12 @@ struct obj_file *arch_new_file(void)
return &f->root;
}
-struct obj_section *arch_new_section(void)
+static struct obj_section *arch_new_section(void)
{
return xmalloc(sizeof(struct obj_section));
}
-struct obj_symbol *arch_new_symbol(void)
+static struct obj_symbol *arch_new_symbol(void)
{
struct arch_symbol *sym;
sym = xmalloc(sizeof(*sym));
@@ -778,7 +773,7 @@ struct obj_symbol *arch_new_symbol(void)
return &sym->root;
}
-enum obj_reloc
+static enum obj_reloc
arch_apply_relocation(struct obj_file *f,
struct obj_section *targsec,
struct obj_section *symsec,
@@ -1140,7 +1135,7 @@ arch_apply_relocation(struct obj_file *f,
return ret;
}
-int arch_create_got(struct obj_file *f)
+static int arch_create_got(struct obj_file *f)
{
#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
struct arch_file *ifile = (struct arch_file *) f;
@@ -1271,7 +1266,7 @@ int arch_create_got(struct obj_file *f)
return 1;
}
-int arch_init_module(struct obj_file *f, struct new_module *mod)
+static int arch_init_module(struct obj_file *f, struct new_module *mod)
{
return 1;
}
@@ -1280,7 +1275,7 @@ int arch_init_module(struct obj_file *f, struct new_module *mod)
/*======================================================================*/
/* Standard ELF hash function. */
-inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
+static inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
{
unsigned long h = 0;
unsigned long g;
@@ -1298,7 +1293,7 @@ inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
return h;
}
-unsigned long obj_elf_hash(const char *name)
+static unsigned long obj_elf_hash(const char *name)
{
return obj_elf_hash_n(name, strlen(name));
}
@@ -1309,25 +1304,15 @@ unsigned long obj_elf_hash(const char *name)
static int get_kernel_version(char str[STRVERSIONLEN])
{
struct utsname uts_info;
- char *p, *q;
- int a, b, c;
+ int kv;
if (uname(&uts_info) < 0)
return -1;
strncpy(str, uts_info.release, STRVERSIONLEN);
- p = uts_info.release;
- a = strtoul(p, &p, 10);
- if (*p != '.')
- return -1;
- b = strtoul(p + 1, &p, 10);
- if (*p != '.')
+ kv = get_kernel_revision();
+ if(kv==0)
return -1;
- c = strtoul(p + 1, &q, 10);
- if (p + 1 == q)
- return -1;
-
- return a << 16 | b << 8 | c;
}
/* String comparison for non-co-versioned kernel and module. */
@@ -1355,7 +1340,7 @@ static unsigned long ncv_symbol_hash(const char *str)
return obj_elf_hash_n(str, len);
}
-void
+static void
obj_set_symbol_compare(struct obj_file *f,
int (*cmp) (const char *, const char *),
unsigned long (*hash) (const char *))
@@ -1383,8 +1368,8 @@ obj_set_symbol_compare(struct obj_file *f,
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-
-struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
+static struct obj_symbol *
+obj_add_symbol(struct obj_file *f, const char *name,
unsigned long symidx, int info,
int secidx, ElfW(Addr) value,
unsigned long size)
@@ -1478,7 +1463,8 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
return sym;
}
-struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
+static struct obj_symbol *
+obj_find_symbol(struct obj_file *f, const char *name)
{
struct obj_symbol *sym;
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)
return NULL;
}
-ElfW(Addr)
+static ElfW(Addr)
obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym)
{
if (sym) {
@@ -1504,7 +1490,7 @@ ElfW(Addr)
}
}
-struct obj_section *obj_find_section(struct obj_file *f, const char *name)
+static struct obj_section *obj_find_section(struct obj_file *f, const char *name)
{
int i, n = f->header.e_shnum;
@@ -1537,7 +1523,7 @@ static int obj_load_order_prio(struct obj_section *a)
return ac;
}
-void
+static void
obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
{
struct obj_section **p;
@@ -1549,7 +1535,7 @@ obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
*p = sec;
}
-struct obj_section *obj_create_alloced_section(struct obj_file *f,
+static struct obj_section *obj_create_alloced_section(struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size)
@@ -1575,7 +1561,7 @@ struct obj_section *obj_create_alloced_section(struct obj_file *f,
return sec;
}
-struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
+static struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size)
@@ -1604,7 +1590,7 @@ struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
return sec;
}
-void *obj_extend_section(struct obj_section *sec, unsigned long more)
+static void *obj_extend_section(struct obj_section *sec, unsigned long more)
{
unsigned long oldsize = sec->header.sh_size;
if (more) {
@@ -1614,7 +1600,6 @@ void *obj_extend_section(struct obj_section *sec, unsigned long more)
}
-
/* Conditionally add the symbols from the given symbol set to the
new module. */
@@ -2631,7 +2616,7 @@ new_init_module(const char *m_name, struct obj_file *f,
/*======================================================================*/
-int
+static int
obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
const char *string)
{
@@ -2660,7 +2645,7 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
return 1;
}
-int
+static int
obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
struct obj_symbol *sym)
{
@@ -2676,7 +2661,7 @@ obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
return 1;
}
-int obj_check_undefineds(struct obj_file *f)
+static int obj_check_undefineds(struct obj_file *f)
{
unsigned long i;
int ret = 1;
@@ -2698,7 +2683,7 @@ int obj_check_undefineds(struct obj_file *f)
return ret;
}
-void obj_allocate_commons(struct obj_file *f)
+static void obj_allocate_commons(struct obj_file *f)
{
struct common_entry {
struct common_entry *next;
@@ -2807,7 +2792,7 @@ void obj_allocate_commons(struct obj_file *f)
}
}
-unsigned long obj_load_size(struct obj_file *f)
+static unsigned long obj_load_size(struct obj_file *f)
{
unsigned long dot = 0;
struct obj_section *sec;
@@ -2828,7 +2813,7 @@ unsigned long obj_load_size(struct obj_file *f)
return dot;
}
-int obj_relocate(struct obj_file *f, ElfW(Addr) base)
+static int obj_relocate(struct obj_file *f, ElfW(Addr) base)
{
int i, n = f->header.e_shnum;
int ret = 1;
@@ -2958,7 +2943,7 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
return ret;
}
-int obj_create_image(struct obj_file *f, char *image)
+static int obj_create_image(struct obj_file *f, char *image)
{
struct obj_section *sec;
ElfW(Addr) base = f->baseaddr;
@@ -2980,7 +2965,7 @@ int obj_create_image(struct obj_file *f, char *image)
/*======================================================================*/
-struct obj_file *obj_load(FILE * fp, int loadprogbits)
+static struct obj_file *obj_load(FILE * fp, int loadprogbits)
{
struct obj_file *f;
ElfW(Shdr) * section_headers;
@@ -3186,7 +3171,7 @@ struct obj_file *obj_load(FILE * fp, int loadprogbits)
* kernel for the module
*/
-int obj_load_progbits(FILE * fp, struct obj_file* f)
+static int obj_load_progbits(FILE * fp, struct obj_file* f)
{
char* imagebase = (char*) f->imagebase;
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)
}
}
-extern int
+static int
mount_one(char *blockDevice, char *directory, char *filesystemType,
unsigned long flags, char *string_flags, int useMtab, int fakeIt,
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 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.45 2001/07/13 20:56:27 kraai Exp $
+ * $Id: ping.c,v 1.46 2001/07/17 01:12:36 andersen Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -430,7 +430,6 @@ static void ping(const char *host)
if (h->h_addrtype != AF_INET)
error_msg_and_die("unknown address type; only AF_INET is currently supported.");
- pingaddr.sin_family = AF_INET; /* h->h_addrtype */
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
strncpy(buf, h->h_name, sizeof(buf) - 1);
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 */
* If the nflag has been supplied, give
* numeric value, otherwise try for symbolic name.
*/
-static inline char *
-inetname(struct in_addr in)
+static inline void
+inetname(struct sockaddr_in *from)
{
char *cp;
- static char line[50];
struct hostent *hp;
static char domain[MAXHOSTNAMELEN + 1];
static int first = 1;
+ const char *ina;
if (first && !nflag) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ (cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
domain[0] = 0;
}
cp = 0;
- if (!nflag && in.s_addr != INADDR_ANY) {
- hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET);
+ if (!nflag && from->sin_addr.s_addr != INADDR_ANY) {
+ hp = gethostbyaddr((char *)&(from->sin_addr), sizeof (from->sin_addr), AF_INET);
if (hp) {
- if ((cp = index(hp->h_name, '.')) &&
+ if ((cp = strchr(hp->h_name, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = (char *)hp->h_name;
}
}
- if (cp)
- (void) strcpy(line, cp);
- else {
- in.s_addr = ntohl(in.s_addr);
- strcpy(line, inet_ntoa(in));
- }
- return (line);
+ ina = inet_ntoa(from->sin_addr);
+ if (nflag)
+ printf(" %s", ina);
+ else
+ printf(" %s (%s)", (cp ? cp : ina), ina);
}
static inline void
@@ -177,12 +175,7 @@ print(u_char *buf, int cc, struct sockaddr_in *from)
hlen = ip->ip_hl << 2;
cc -= hlen;
- if (nflag)
- printf(" %s", inet_ntoa(from->sin_addr));
- else
- printf(" %s (%s)", inetname(from->sin_addr),
- inet_ntoa(from->sin_addr));
-
+ inetname(from);
#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
if (verbose)
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 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.45 2001/07/13 20:56:27 kraai Exp $
+ * $Id: ping.c,v 1.46 2001/07/17 01:12:36 andersen Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -430,7 +430,6 @@ static void ping(const char *host)
if (h->h_addrtype != AF_INET)
error_msg_and_die("unknown address type; only AF_INET is currently supported.");
- pingaddr.sin_family = AF_INET; /* h->h_addrtype */
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
strncpy(buf, h->h_name, sizeof(buf) - 1);
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:
if (!iflag)
nr = safe_read(parsefile->fd, buf, BUFSIZ - 1);
else {
- cmdedit_read_input((char*)cmdedit_prompt, buf);
- nr = strlen(buf);
+ nr = cmdedit_read_input((char*)cmdedit_prompt, buf);
}
}
#else
@@ -9445,7 +9444,7 @@ static char *wordtext; /* text of last word returned by readtok
static struct nodelist *backquotelist;
static union node *redirnode;
-struct heredoc *heredoc;
+static struct heredoc *heredoc;
static int quoteflag; /* set if (part of) last token was quoted */
static int startlinno; /* line # where last token started */
@@ -12917,7 +12916,7 @@ findvar(struct var **vpp, const char *name)
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin.
- * $Id: ash.c,v 1.10 2001/07/12 20:26:31 andersen Exp $
+ * $Id: ash.c,v 1.11 2001/07/17 01:12:35 andersen Exp $
*/
static int timescmd (int argc, char **argv)
{
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 {
*
*/
-extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
+
+int cmdedit_read_input(char *prompt, char command[BUFSIZ])
{
int break_out = 0;
@@ -1231,10 +1232,15 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
* if the len=0 and no chars to delete */
if (len == 0) {
prepare_to_die:
+#if !defined(BB_FEATURE_ASH)
printf("exit");
goto_new_line();
/* cmdedit_reset_term() called in atexit */
exit(EXIT_SUCCESS);
+#else
+ break_out = -1; /* for control stoped jobs */
+ break;
+#endif
} else {
input_delete();
}
@@ -1455,8 +1461,10 @@ prepare_to_die:
num_ok_lines++;
#endif
}
+ if(break_out>0) {
command[len++] = '\n'; /* set '\n' */
command[len] = 0;
+ }
#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
input_tab(0); /* strong free */
#endif
@@ -1464,6 +1472,7 @@ prepare_to_die:
free(cmdedit_prompt);
#endif
cmdedit_reset_term();
+ return len;
}
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 @@
#ifndef CMDEDIT_H
#define CMDEDIT_H
-void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */
+int cmdedit_read_input(char* promptStr, char* command);
#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;
struct iovec iov[IOV_COUNT];
struct iovec *v = iov;
- bzero(&res, sizeof(res));
+ memset(&res, 0, sizeof(res));
snprintf(res, sizeof(res), "<%d>", pri);
v->iov_base = res ;
v->iov_len = strlen(res);
@@ -442,7 +442,7 @@ static void init_RemoteLog (void){
struct hostent *hostinfo;
int len = sizeof(remoteaddr);
- bzero(&remoteaddr, len);
+ memset(&remoteaddr, 0, len);
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
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;
struct iovec iov[IOV_COUNT];
struct iovec *v = iov;
- bzero(&res, sizeof(res));
+ memset(&res, 0, sizeof(res));
snprintf(res, sizeof(res), "<%d>", pri);
v->iov_base = res ;
v->iov_len = strlen(res);
@@ -442,7 +442,7 @@ static void init_RemoteLog (void){
struct hostent *hostinfo;
int len = sizeof(remoteaddr);
- bzero(&remoteaddr, len);
+ memset(&remoteaddr, 0, len);
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
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 */
* If the nflag has been supplied, give
* numeric value, otherwise try for symbolic name.
*/
-static inline char *
-inetname(struct in_addr in)
+static inline void
+inetname(struct sockaddr_in *from)
{
char *cp;
- static char line[50];
struct hostent *hp;
static char domain[MAXHOSTNAMELEN + 1];
static int first = 1;
+ const char *ina;
if (first && !nflag) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ (cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
domain[0] = 0;
}
cp = 0;
- if (!nflag && in.s_addr != INADDR_ANY) {
- hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET);
+ if (!nflag && from->sin_addr.s_addr != INADDR_ANY) {
+ hp = gethostbyaddr((char *)&(from->sin_addr), sizeof (from->sin_addr), AF_INET);
if (hp) {
- if ((cp = index(hp->h_name, '.')) &&
+ if ((cp = strchr(hp->h_name, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = (char *)hp->h_name;
}
}
- if (cp)
- (void) strcpy(line, cp);
- else {
- in.s_addr = ntohl(in.s_addr);
- strcpy(line, inet_ntoa(in));
- }
- return (line);
+ ina = inet_ntoa(from->sin_addr);
+ if (nflag)
+ printf(" %s", ina);
+ else
+ printf(" %s (%s)", (cp ? cp : ina), ina);
}
static inline void
@@ -177,12 +175,7 @@ print(u_char *buf, int cc, struct sockaddr_in *from)
hlen = ip->ip_hl << 2;
cc -= hlen;
- if (nflag)
- printf(" %s", inet_ntoa(from->sin_addr));
- else
- printf(" %s (%s)", inetname(from->sin_addr),
- inet_ntoa(from->sin_addr));
-
+ inetname(from);
#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
if (verbose)
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)
}
}
-extern int
+static int
mount_one(char *blockDevice, char *directory, char *filesystemType,
unsigned long flags, char *string_flags, int useMtab, int fakeIt,
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 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-char *vi_Version =
- "$Id: vi.c,v 1.11 2001/07/02 18:06:14 andersen Exp $";
+static const char vi_Version[] =
+ "$Id: vi.c,v 1.12 2001/07/17 01:12:36 andersen Exp $";
/*
* To compile for standalone use: