OSDN Git Service

Fix header file usage -- there were many unnecessary header files included in
authorEric Andersen <andersen@codepoet.org>
Sat, 27 Jan 2001 08:24:39 +0000 (08:24 -0000)
committerEric Andersen <andersen@codepoet.org>
Sat, 27 Jan 2001 08:24:39 +0000 (08:24 -0000)
busybox.h which slowed compiles.  I left only what was needed and then fixed up
all the apps to include their own header files.  I also fixed naming for pwd.h
and grp.h functions.  Tested to compile and run with libc5, glibc, and uClibc.
 -Erik

167 files changed:
Config.h
Makefile
applets/busybox.c
ar.c
archival/ar.c
archival/dpkg_deb.c
archival/gzip.c
archival/tar.c
basename.c
busybox.c
busybox.h
cat.c
chmod_chown_chgrp.c
chroot.c
clear.c
cmp.c
console-tools/clear.c
console-tools/dumpkmap.c
console-tools/loadkmap.c
console-tools/reset.c
coreutils/basename.c
coreutils/cat.c
coreutils/chroot.c
coreutils/cmp.c
coreutils/date.c
coreutils/dd.c
coreutils/df.c
coreutils/dirname.c
coreutils/du.c
coreutils/echo.c
coreutils/expr.c
coreutils/head.c
coreutils/hostid.c
coreutils/id.c
coreutils/ln.c
coreutils/logname.c
coreutils/ls.c
coreutils/mkdir.c
coreutils/mkfifo.c
coreutils/mknod.c
coreutils/pwd.c
coreutils/rm.c
coreutils/rmdir.c
coreutils/sleep.c
coreutils/sort.c
coreutils/sync.c
coreutils/tail.c
coreutils/touch.c
coreutils/tr.c
coreutils/tty.c
coreutils/uname.c
coreutils/uniq.c
coreutils/uudecode.c
coreutils/uuencode.c
coreutils/wc.c
coreutils/whoami.c
coreutils/yes.c
cp_mv.c
date.c
dd.c
df.c
dirname.c
dmesg.c
dpkg_deb.c
du.c
dumpkmap.c
dutmp.c
echo.c
editors/sed.c
expr.c
fbset.c
fdflush.c
find.c
findutils/find.c
findutils/grep.c
findutils/which.c
free.c
freeramdisk.c
grep.c
gzip.c
head.c
hostid.c
hostname.c
id.c
include/busybox.h
include/grp.h
include/pwd.h
init.c
init/init.c
insmod.c
kill.c
ln.c
loadkmap.c
logger.c
logname.c
ls.c
miscutils/dutmp.c
miscutils/mktemp.c
miscutils/mt.c
miscutils/readlink.c
miscutils/update.c
miscutils/watchdog.c
mkdir.c
mkfifo.c
mknod.c
mktemp.c
modutils/insmod.c
modutils/rmmod.c
more.c
mt.c
networking/hostname.c
networking/nslookup.c
networking/ping.c
networking/wget.c
nslookup.c
ping.c
procps/free.c
procps/kill.c
procps/ps.c
procps/renice.c
procps/uptime.c
ps.c
pwd.c
rdate.c
readlink.c
renice.c
reset.c
rm.c
rmdir.c
rmmod.c
rpmunpack.c
sed.c
sleep.c
sort.c
swaponoff.c
sync.c
sysklogd/logger.c
sysklogd/syslogd.c
syslogd.c
tail.c
tar.c
touch.c
tr.c
true_false.c
tty.c
umount.c
uname.c
uniq.c
update.c
uptime.c
util-linux/dmesg.c
util-linux/fbset.c
util-linux/fdflush.c
util-linux/freeramdisk.c
util-linux/more.c
util-linux/rdate.c
util-linux/swaponoff.c
util-linux/umount.c
utility.c
uudecode.c
uuencode.c
watchdog.c
wc.c
wget.c
which.c
whoami.c
yes.c

index 5e14b40..b11d849 100644 (file)
--- a/Config.h
+++ b/Config.h
 #endif
 #endif
 //
-#if defined BB_FEATURE_LINUXRC || defined BB_LINUXRC
 #ifndef BB_INIT
-#define BB_INIT
-#endif
-#ifndef BB_LINUXRC
-#define BB_LINUXRC
-#endif
+#undef BB_LINUXRC
+#undef BB_FEATURE_LINUXRC
 #endif
 //
 #ifdef BB_GZIP
index d5587ae..159e5d5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -81,24 +81,19 @@ CROSS =
 CC = $(CROSS)gcc
 STRIPTOOL = $(CROSS)strip
 
-# To compile vs an alternative libc, you may need to use/adjust
-# the following lines to meet your needs.  This is how I make
-# busybox compile staticly with uClibc (needs BB_FEATURE_NFSMOUNT
-# disabled at the moment).  Note the _full_ path for LIBCDIR.
-# This is because make doesn't do ~ expansion...
-#LIBCDIR=/home/andersen/CVS/uClibc
+# To compile vs uClibc, just use the compiler wrapper built by uClibc...
+# Isn't that easy?  Right now, uClibc needs BB_FEATURE_NFSMOUNT disabled 
+# since uClibc's nfs support isn't ready yet.
+#CC = ../uClibc/extra/gcc-uClibc/gcc-uClibc-i386
+
+# To compile vs some other alternative libc, you may need to use/adjust
+# the following lines to meet your needs...
+#LIBCDIR=/usr/i486-linuxlibc1/
 #LDFLAGS+=-nostdlib
 #LIBRARIES = $(LIBCDIR)/libc.a -lgcc
 #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
 #GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
 
-# This is how I compile with the uClibc shared lib...
-#LIBCDIR=/home/andersen/CVS/uClibc
-#LDFLAGS+=-nostdlib
-#LIBRARIES = -luClibc -lgcc $(LIBCDIR)/crt0.o
-#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
-#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
-
 #--------------------------------------------------------
 
 # use '-Os' optimization if available, else use -O2
index 5eb9dfa..ab3762e 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+#include <stdlib.h>
 
 #undef APPLET
 #undef APPLET_NOUSAGE
diff --git a/ar.c b/ar.c
index 596574e..550b2a1 100644 (file)
--- a/ar.c
+++ b/ar.c
  *
  */
 #include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <unistd.h>
 #include "busybox.h"
 
 typedef struct ar_headers_s {
index 596574e..550b2a1 100644 (file)
  *
  */
 #include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <unistd.h>
 #include "busybox.h"
 
 typedef struct ar_headers_s {
index 3590495..3a78937 100644 (file)
@@ -17,6 +17,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 #include "busybox.h"
 
 typedef struct ar_headers_s {
index 0926092..5a74868 100644 (file)
@@ -45,6 +45,7 @@
  */
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #define memzero(s, n)     memset ((void *)(s), 0, (n))
 
 #ifndef RETSIGTYPE
index 51a857d..2c7169b 100644 (file)
@@ -52,6 +52,9 @@
 #include <sys/sysmacros.h>
 #include <getopt.h>
 #include <fnmatch.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #ifdef BB_FEATURE_TAR_GZIP
 extern int unzip(int in, int out);
index fcc7d46..0caae39 100644 (file)
@@ -22,7 +22,8 @@
  */
 
 #include "busybox.h"
-#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 extern int basename_main(int argc, char **argv)
 {
index 5eb9dfa..ab3762e 100644 (file)
--- a/busybox.c
+++ b/busybox.c
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+#include <stdlib.h>
 
 #undef APPLET
 #undef APPLET_NOUSAGE
index be6c6f3..5f9425a 100644 (file)
--- a/busybox.h
+++ b/busybox.h
 
 #include "Config.h"
 
-#include <stdlib.h>
+#include <stdio.h>
 #include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
 #include <sys/stat.h>
-#include <sys/param.h>
 #include <sys/types.h>
-#include <mntent.h>
-#include <regex.h>
-/* for the _syscall() macros */
-#include <sys/syscall.h>
-#include <linux/unistd.h>
 
 #ifdef DMALLOC
 #include "dmalloc.h"
@@ -69,26 +60,6 @@ static inline int is_octal(ch)   { return ((ch >= '0') && (ch <= '7')); }
 #endif
 
 
-/* I don't like nested includes, but the string and io functions are used
- * too often
- */
-#include <stdio.h>
-#if !defined(NO_STRING_H) || defined(STDC_HEADERS)
-#  include <string.h>
-#  if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
-#    include <memory.h>
-#  endif
-#  define memzero(s, n)     memset ((void *)(s), 0, (n))
-#else
-#  include <strings.h>
-#  define strchr            index
-#  define strrchr           rindex
-#  define memcpy(d, s, n)   bcopy((s), (d), (n))
-#  define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
-#  define memzero(s, n)     bzero((s), (n))
-#endif
-
-
 enum Location {
        _BB_DIR_ROOT = 0,
        _BB_DIR_BIN,
@@ -179,7 +150,6 @@ extern void print_file(FILE *file);
 extern int print_file_by_name(char *filename);
 extern char process_escape_sequence(char **ptr);
 extern char *get_last_path_component(char *path);
-extern void xregcomp(regex_t *preg, const char *regex, int cflags);
 extern FILE *wfopen(const char *path, const char *mode);
 extern FILE *xfopen(const char *path, const char *mode);
 
diff --git a/cat.c b/cat.c
index 151ce4e..a1b8782 100644 (file)
--- a/cat.c
+++ b/cat.c
@@ -22,7 +22,7 @@
  */
 
 #include "busybox.h"
-#include <stdio.h>
+#include <stdlib.h>
 
 extern int cat_main(int argc, char **argv)
 {
index f6ecfd6..08ea6ee 100644 (file)
@@ -29,6 +29,9 @@
 #include "messages.c"
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 
 static long uid = -1;
index 91d3407..e6f1d03 100644 (file)
--- a/chroot.c
+++ b/chroot.c
@@ -25,6 +25,7 @@
 #include "busybox.h"
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
 #include <errno.h>
 
 int chroot_main(int argc, char **argv)
diff --git a/clear.c b/clear.c
index ca83f38..98eef1d 100644 (file)
--- a/clear.c
+++ b/clear.c
@@ -24,6 +24,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 
 
 extern int clear_main(int argc, char **argv)
diff --git a/cmp.c b/cmp.c
index 6b95544..a4b6c7d 100644 (file)
--- a/cmp.c
+++ b/cmp.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+#include <stdlib.h>
 
 int cmp_main(int argc, char **argv)
 {
index ca83f38..98eef1d 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 
 
 extern int clear_main(int argc, char **argv)
index b438ba2..b2067b3 100644 (file)
@@ -24,6 +24,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 #include <sys/ioctl.h>
 
 /* From <linux/kd.h> */
index 43c1cc7..75b40da 100644 (file)
@@ -24,6 +24,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 
 #define BINARY_KEYMAP_MAGIC "bkeymap"
index bf8c3ed..861bd43 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 
 extern int reset_main(int argc, char **argv)
 {
index fcc7d46..0caae39 100644 (file)
@@ -22,7 +22,8 @@
  */
 
 #include "busybox.h"
-#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 extern int basename_main(int argc, char **argv)
 {
index 151ce4e..a1b8782 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include "busybox.h"
-#include <stdio.h>
+#include <stdlib.h>
 
 extern int cat_main(int argc, char **argv)
 {
index 91d3407..e6f1d03 100644 (file)
@@ -25,6 +25,7 @@
 #include "busybox.h"
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
 #include <errno.h>
 
 int chroot_main(int argc, char **argv)
index 6b95544..a4b6c7d 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+#include <stdlib.h>
 
 int cmp_main(int argc, char **argv)
 {
index 73fc705..8b6a062 100644 (file)
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <time.h>
 #include <stdio.h>
+#include <string.h>
 #include <getopt.h>
 
 
index 32eeb66..dac9ccd 100644 (file)
 #include "busybox.h"
 
 #include <sys/types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
 #include <fcntl.h>
 
 static struct suffix_mult dd_suffixes[] = {
index 22797fb..0408f9f 100644 (file)
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <mntent.h>
 #include <sys/vfs.h>
+#include <getopt.h>
 
 extern const char mtab_file[]; /* Defined in utility.c */
 #ifdef BB_FEATURE_HUMAN_READABLE
index 63c557a..333f08d 100644 (file)
@@ -22,6 +22,8 @@
  */
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 extern int dirname_main(int argc, char **argv)
 {
index 56a7a9a..9cc2a67 100644 (file)
@@ -31,6 +31,8 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
 #include <errno.h>
 
 #ifdef BB_FEATURE_HUMAN_READABLE
@@ -185,7 +187,7 @@ int du_main(int argc, char **argv)
        return status;
 }
 
-/* $Id: du.c,v 1.34 2001/01/22 22:35:38 rjune Exp $ */
+/* $Id: du.c,v 1.35 2001/01/27 08:24:37 andersen Exp $ */
 /*
 Local Variables:
 c-file-style: "linux"
index 393f442..b3e01af 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 
 extern int 
 echo_main(int argc, char** argv)
index eed2637..71bd224 100644 (file)
 
 #include "busybox.h"
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <regex.h>
 #include <sys/types.h>
 
-#include <regex.h>
 
 /* The kinds of value we can have.  */
 enum valtype {
index a0ca453..71aa825 100644 (file)
@@ -25,6 +25,8 @@
 #include "busybox.h"
 #include <errno.h>
 #include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
 
 int head(int len, FILE *fp)
 {
index 35a5859..eed1a50 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 extern int hostid_main(int argc, char **argv)
 {
index d50de47..e91ac75 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <string.h>
 #include <sys/types.h>
 
 extern int id_main(int argc, char **argv)
index e69cb02..d6bf644 100644 (file)
 
 #include <stdio.h>
 #include <dirent.h>
+#include <string.h>
+#include <stdlib.h>
 #include <errno.h>
+#include <unistd.h>
 
 static const int LN_SYMLINK = 1;
 static const int LN_FORCE = 2;
index d614e85..edec016 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 extern int logname_main(int argc, char **argv)
 {
index 4b225d6..affa48c 100644 (file)
@@ -59,6 +59,7 @@ static const int COLUMN_GAP = 2;                      /* includes the file type char, if present */
 #include <time.h>
 #endif
 #include <string.h>
+#include <stdlib.h>
 
 #include <fcntl.h>
 #include <signal.h>
index 92357a6..eb6e7db 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
+#include <stdlib.h>
 
 static int parentFlag = FALSE;
 static mode_t mode = 0777;
index 728e1ec..b31e6f1 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <errno.h>
+#include <stdlib.h>
 
 extern int mkfifo_main(int argc, char **argv)
 {
index 4d8c598..c761aea 100644 (file)
@@ -26,6 +26,8 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 
 int mknod_main(int argc, char **argv)
 {
index da089f3..a9acbc7 100644 (file)
@@ -25,6 +25,8 @@
 #include <stdio.h>
 #include <dirent.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int pwd_main(int argc, char **argv)
 {
index a9501ec..302599e 100644 (file)
@@ -28,6 +28,8 @@
 #include <utime.h>
 #include <dirent.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 static int recursiveFlag = FALSE;
 static int forceFlag = FALSE;
index f9f82bb..8c2165e 100644 (file)
@@ -25,6 +25,8 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int rmdir_main(int argc, char **argv)
 {
index 10eca59..61b7ce4 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int sleep_main(int argc, char **argv)
 {
index efff6b6..2aef2d9 100644 (file)
@@ -22,6 +22,8 @@
  */
 
 #include "busybox.h"
+#include <getopt.h>
+#include <stdlib.h>
 
 int compare_ascii(const void *x, const void *y)
 {
index 8f101cf..f95c24c 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <unistd.h>
 
 extern int sync_main(int argc, char **argv)
 {
index dc5918d..40511aa 100644 (file)
 
 #include "busybox.h"
 
-#include <sys/types.h>
 #include <fcntl.h>
+#include <getopt.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
 
 static struct suffix_mult tail_suffixes[] = {
        { "b", 512 },
index 1b03075..fa2f3b6 100644 (file)
@@ -28,6 +28,8 @@
 #include <fcntl.h>
 #include <utime.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int touch_main(int argc, char **argv)
 {
index 15e3709..2717a92 100644 (file)
@@ -191,9 +191,9 @@ extern int tr_main(int argc, char **argv)
                        map(input, input_length, output, output_length);
                }
                for (i = 0; i < input_length; i++)
-                       invec[input[i]] = TRUE;
+                       invec[(int)input[i]] = TRUE;
                for (i = 0; i < output_length; i++)
-                       outvec[output[i]] = TRUE;
+                       outvec[(int)output[i]] = TRUE;
        }
        convert();
        return (0);
index 46201d3..2a64b14 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <sys/types.h>
 
 extern int tty_main(int argc, char **argv)
index 4f7c643..deaffd7 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
 
index c0229ae..2288559 100644 (file)
@@ -26,7 +26,9 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <string.h>
+#include <getopt.h>
 #include <errno.h>
+#include <stdlib.h>
 
 static int print_count;
 static int print_uniq = 1;
index 7b26d2d..fcfcfd9 100644 (file)
 #include <stdio.h>
 #include <errno.h>
 #include <getopt.h>
+#include <string.h>
+#include <stdlib.h>
+#include "pwd_grp/pwd.h"
+#include "pwd_grp/grp.h"
 
 /*struct passwd *getpwnam();*/
 
index 24aabd3..5df4902 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <getopt.h>
+#include <stdlib.h>
 
 #define        RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
 
index e6f7534..619c161 100644 (file)
@@ -23,6 +23,7 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <getopt.h>
+#include <stdlib.h>
 
 static int total_lines, total_words, total_chars, max_length;
 static int print_lines, print_words, print_chars, print_length;
index d7f0a17..870ede4 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 extern int whoami_main(int argc, char **argv)
 {
index 46873f3..0ce4949 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 
 extern int yes_main(int argc, char **argv)
 {
diff --git a/cp_mv.c b/cp_mv.c
index 9bcac02..41b981b 100644 (file)
--- a/cp_mv.c
+++ b/cp_mv.c
@@ -42,6 +42,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <getopt.h>
+#include <stdlib.h>
 
 static const int is_cp = 0;
 static const int is_mv = 1;
diff --git a/date.c b/date.c
index 73fc705..8b6a062 100644 (file)
--- a/date.c
+++ b/date.c
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <time.h>
 #include <stdio.h>
+#include <string.h>
 #include <getopt.h>
 
 
diff --git a/dd.c b/dd.c
index 32eeb66..dac9ccd 100644 (file)
--- a/dd.c
+++ b/dd.c
 #include "busybox.h"
 
 #include <sys/types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
 #include <fcntl.h>
 
 static struct suffix_mult dd_suffixes[] = {
diff --git a/df.c b/df.c
index 22797fb..0408f9f 100644 (file)
--- a/df.c
+++ b/df.c
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <mntent.h>
 #include <sys/vfs.h>
+#include <getopt.h>
 
 extern const char mtab_file[]; /* Defined in utility.c */
 #ifdef BB_FEATURE_HUMAN_READABLE
index 63c557a..333f08d 100644 (file)
--- a/dirname.c
+++ b/dirname.c
@@ -22,6 +22,8 @@
  */
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 extern int dirname_main(int argc, char **argv)
 {
diff --git a/dmesg.c b/dmesg.c
index c220d90..c21f84c 100644 (file)
--- a/dmesg.c
+++ b/dmesg.c
 #include "busybox.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <getopt.h>
 
 #if __GNU_LIBRARY__ < 5
-
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 #ifndef __alpha__
 # define __NR_klogctl __NR_syslog
 static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
index 3590495..3a78937 100644 (file)
@@ -17,6 +17,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 #include "busybox.h"
 
 typedef struct ar_headers_s {
diff --git a/du.c b/du.c
index 56a7a9a..9cc2a67 100644 (file)
--- a/du.c
+++ b/du.c
@@ -31,6 +31,8 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
 #include <errno.h>
 
 #ifdef BB_FEATURE_HUMAN_READABLE
@@ -185,7 +187,7 @@ int du_main(int argc, char **argv)
        return status;
 }
 
-/* $Id: du.c,v 1.34 2001/01/22 22:35:38 rjune Exp $ */
+/* $Id: du.c,v 1.35 2001/01/27 08:24:37 andersen Exp $ */
 /*
 Local Variables:
 c-file-style: "linux"
index b438ba2..b2067b3 100644 (file)
@@ -24,6 +24,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 #include <sys/ioctl.h>
 
 /* From <linux/kd.h> */
diff --git a/dutmp.c b/dutmp.c
index efd15df..7e1d2ee 100644 (file)
--- a/dutmp.c
+++ b/dutmp.c
@@ -21,6 +21,8 @@
 #define bb_need_io_error
 #include "messages.c"
 #include <utmp.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 extern int dutmp_main(int argc, char **argv)
 {
@@ -35,7 +37,7 @@ extern int dutmp_main(int argc, char **argv)
        } else  {
                file = open(argv[1], O_RDONLY);
                if (file < 0) {
-                       error_msg_and_die(io_error, argv[1], strerror(errno));
+                       perror_msg_and_die(io_error, argv[1]);
                }
        }
 
diff --git a/echo.c b/echo.c
index 393f442..b3e01af 100644 (file)
--- a/echo.c
+++ b/echo.c
@@ -24,6 +24,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 
 extern int 
 echo_main(int argc, char** argv)
index a50d8d0..95aad79 100644 (file)
 #include <string.h> /* for strdup() */
 #include <errno.h>
 #include <ctype.h> /* for isspace() */
+#include <stdlib.h>
 #include "busybox.h"
 
 /* externs */
+extern void xregcomp(regex_t *preg, const char *regex, int cflags);
 extern int optind; /* in unistd.h */
 extern char *optarg; /* ditto */
 
diff --git a/expr.c b/expr.c
index eed2637..71bd224 100644 (file)
--- a/expr.c
+++ b/expr.c
 
 #include "busybox.h"
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <regex.h>
 #include <sys/types.h>
 
-#include <regex.h>
 
 /* The kinds of value we can have.  */
 enum valtype {
diff --git a/fbset.c b/fbset.c
index 845be84..637896b 100644 (file)
--- a/fbset.c
+++ b/fbset.c
@@ -31,6 +31,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
+#include <string.h>
 #include <sys/ioctl.h>
 
 #define DEFAULTFBDEV  "/dev/fb0"
index 5eb93dd..fcf8ddd 100644 (file)
--- a/fdflush.c
+++ b/fdflush.c
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 /* From <linux/fd.h> */
 #define FDFLUSH  _IO(2,0x4b)
diff --git a/find.c b/find.c
index 32d7db7..59a5b83 100644 (file)
--- a/find.c
+++ b/find.c
@@ -26,6 +26,8 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <string.h>
+#include <stdlib.h>
 
 
 static char *pattern = NULL;
index 32d7db7..59a5b83 100644 (file)
@@ -26,6 +26,8 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <string.h>
+#include <stdlib.h>
 
 
 static char *pattern = NULL;
index 0ed9594..e9ff91b 100644 (file)
@@ -28,6 +28,8 @@
 #include <errno.h>
 #include "busybox.h"
 
+extern void xregcomp(regex_t *preg, const char *regex, int cflags);
+
 extern int optind; /* in unistd.h */
 extern int errno;  /* for use with strerror() */
 
index a92777e..b900a0b 100644 (file)
@@ -22,7 +22,9 @@
  */
 
 #include "busybox.h"
+#include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 extern int which_main(int argc, char **argv)
 {
diff --git a/free.c b/free.c
index f2e746e..4dd99ab 100644 (file)
--- a/free.c
+++ b/free.c
@@ -24,6 +24,7 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <errno.h>
+#include <stdlib.h>
 
 extern int free_main(int argc, char **argv)
 {
index a2b17c6..8f90f40 100644 (file)
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <errno.h>
+#include <stdlib.h>
 #include "busybox.h"
 
 
diff --git a/grep.c b/grep.c
index 0ed9594..e9ff91b 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -28,6 +28,8 @@
 #include <errno.h>
 #include "busybox.h"
 
+extern void xregcomp(regex_t *preg, const char *regex, int cflags);
+
 extern int optind; /* in unistd.h */
 extern int errno;  /* for use with strerror() */
 
diff --git a/gzip.c b/gzip.c
index 0926092..5a74868 100644 (file)
--- a/gzip.c
+++ b/gzip.c
@@ -45,6 +45,7 @@
  */
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #define memzero(s, n)     memset ((void *)(s), 0, (n))
 
 #ifndef RETSIGTYPE
diff --git a/head.c b/head.c
index a0ca453..71aa825 100644 (file)
--- a/head.c
+++ b/head.c
@@ -25,6 +25,8 @@
 #include "busybox.h"
 #include <errno.h>
 #include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
 
 int head(int len, FILE *fp)
 {
index 35a5859..eed1a50 100644 (file)
--- a/hostid.c
+++ b/hostid.c
@@ -22,6 +22,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 extern int hostid_main(int argc, char **argv)
 {
index b1f0613..a789fa0 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: hostname.c,v 1.20 2001/01/24 18:44:54 andersen Exp $
+ * $Id: hostname.c,v 1.21 2001/01/27 08:24:37 andersen Exp $
  * Mini hostname implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -28,6 +28,7 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <unistd.h>
+#include <string.h>
 #include <stdio.h>
 
 void do_sethostname(char *s, int isfile)
diff --git a/id.c b/id.c
index d50de47..e91ac75 100644 (file)
--- a/id.c
+++ b/id.c
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <string.h>
 #include <sys/types.h>
 
 extern int id_main(int argc, char **argv)
index be6c6f3..5f9425a 100644 (file)
 
 #include "Config.h"
 
-#include <stdlib.h>
+#include <stdio.h>
 #include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
 #include <sys/stat.h>
-#include <sys/param.h>
 #include <sys/types.h>
-#include <mntent.h>
-#include <regex.h>
-/* for the _syscall() macros */
-#include <sys/syscall.h>
-#include <linux/unistd.h>
 
 #ifdef DMALLOC
 #include "dmalloc.h"
@@ -69,26 +60,6 @@ static inline int is_octal(ch)   { return ((ch >= '0') && (ch <= '7')); }
 #endif
 
 
-/* I don't like nested includes, but the string and io functions are used
- * too often
- */
-#include <stdio.h>
-#if !defined(NO_STRING_H) || defined(STDC_HEADERS)
-#  include <string.h>
-#  if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
-#    include <memory.h>
-#  endif
-#  define memzero(s, n)     memset ((void *)(s), 0, (n))
-#else
-#  include <strings.h>
-#  define strchr            index
-#  define strrchr           rindex
-#  define memcpy(d, s, n)   bcopy((s), (d), (n))
-#  define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
-#  define memzero(s, n)     bzero((s), (n))
-#endif
-
-
 enum Location {
        _BB_DIR_ROOT = 0,
        _BB_DIR_BIN,
@@ -179,7 +150,6 @@ extern void print_file(FILE *file);
 extern int print_file_by_name(char *filename);
 extern char process_escape_sequence(char **ptr);
 extern char *get_last_path_component(char *path);
-extern void xregcomp(regex_t *preg, const char *regex, int cflags);
 extern FILE *wfopen(const char *path, const char *mode);
 extern FILE *xfopen(const char *path, const char *mode);
 
index f27c466..87d4115 100644 (file)
@@ -5,16 +5,6 @@
 #include <grp.h>
 #else
 
-#define bb_setgrent setgrent
-#define bb_endgrent endgrent
-#define bb_getgrent getgrent
-#define bb_getgrgid getgrgid
-#define bb_getgrnam getgrnam
-#define bb_fgetgrent fgetgrent
-#define bb_setgroups setgroups
-#define bb_initgroups initgroups
-#define __bb_getgrent __getgrent
-
 #include <sys/types.h>
 #include <features.h>
 #include <stdio.h>
@@ -28,19 +18,19 @@ struct group
   char **gr_mem;               /* Member list. */
 };
 
-extern void bb_setgrent __P ((void));
-extern void bb_endgrent __P ((void));
-extern struct group * bb_getgrent __P ((void));
+extern void setgrent __P ((void));
+extern void endgrent __P ((void));
+extern struct group * getgrent __P ((void));
 
-extern struct group * bb_getgrgid __P ((__const gid_t gid));
-extern struct group * bb_getgrnam __P ((__const char * name));
+extern struct group * getgrgid __P ((__const gid_t gid));
+extern struct group * getgrnam __P ((__const char * name));
 
-extern struct group * bb_fgetgrent __P ((FILE * file));
+extern struct group * fgetgrent __P ((FILE * file));
 
-extern int bb_setgroups __P ((size_t n, __const gid_t * groups));
-extern int bb_initgroups __P ((__const char * user, gid_t gid));
+extern int setgroups __P ((size_t n, __const gid_t * groups));
+extern int initgroups __P ((__const char * user, gid_t gid));
 
-extern struct group * __bb_getgrent __P ((int grp_fd));
+extern struct group * __getgrent __P ((int grp_fd));
 
 #endif /* USE_SYSTEM_PWD_GRP */
 #endif /* __BB_GRP_H */
index 82743f5..e603a96 100644 (file)
@@ -5,17 +5,6 @@
 #include <pwd.h>
 #else
 
-#define bb_setpwent setpwent
-#define bb_endpwent endpwent
-#define bb_getpwent getpwent
-#define bb_putpwent putpwent
-#define bb_getpw getpw
-#define bb_fgetpwent fgetpwent
-#define bb_getpwuid getpwuid
-#define bb_getpwnam getpwnam
-#define __bb_getpwent __bb_getpwent
-
-
 #include <sys/types.h>
 #include <features.h>
 #include <stdio.h>
@@ -32,19 +21,19 @@ struct passwd
   char *pw_shell;              /* Shell program.  */
 };
 
-extern void bb_setpwent __P ((void));
-extern void bb_endpwent __P ((void));
-extern struct passwd * bb_getpwent __P ((void));
+extern void setpwent __P ((void));
+extern void endpwent __P ((void));
+extern struct passwd * getpwent __P ((void));
 
-extern int bb_putpwent __P ((__const struct passwd * __p, FILE * __f));
-extern int bb_getpw __P ((uid_t uid, char *buf));
+extern int putpwent __P ((__const struct passwd * __p, FILE * __f));
+extern int getpw __P ((uid_t uid, char *buf));
 
-extern struct passwd * bb_fgetpwent __P ((FILE * file));
+extern struct passwd * fgetpwent __P ((FILE * file));
 
-extern struct passwd * bb_getpwuid __P ((__const uid_t));
-extern struct passwd * bb_getpwnam __P ((__const char *));
+extern struct passwd * getpwuid __P ((__const uid_t));
+extern struct passwd * getpwnam __P ((__const char *));
 
-extern struct passwd * __bb_getpwent __P ((__const int passwd_fd));
+extern struct passwd * __getpwent __P ((__const int passwd_fd));
 
 #endif /* USE_SYSTEM_PWD_GRP */
 #endif /* __BB_PWD_H  */
diff --git a/init.c b/init.c
index 8690648..5d0d924 100644 (file)
--- a/init.c
+++ b/init.c
@@ -37,6 +37,7 @@
 #include <string.h>
 #include <termios.h>
 #include <unistd.h>
+#include <limits.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/mount.h>
@@ -114,6 +115,8 @@ static const int RB_AUTOBOOT = 0x01234567;
 #if defined(__GLIBC__)
 #include <sys/kdaemon.h>
 #else
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 static _syscall2(int, bdflush, int, func, int, data);
 #endif                                                 /* __GLIBC__ */
 
index 8690648..5d0d924 100644 (file)
@@ -37,6 +37,7 @@
 #include <string.h>
 #include <termios.h>
 #include <unistd.h>
+#include <limits.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/mount.h>
@@ -114,6 +115,8 @@ static const int RB_AUTOBOOT = 0x01234567;
 #if defined(__GLIBC__)
 #include <sys/kdaemon.h>
 #else
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 static _syscall2(int, bdflush, int, func, int, data);
 #endif                                                 /* __GLIBC__ */
 
index 6ac2dcd..b82728a 100644 (file)
--- a/insmod.c
+++ b/insmod.c
 #include <dirent.h>
 #include <ctype.h>
 #include <assert.h>
+#include <string.h>
 #include <getopt.h>
 #include <sys/utsname.h>
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 
 //----------------------------------------------------------------------------
 //--------modutils module.h, lines 45-242
@@ -78,7 +81,7 @@
 #ifndef MODUTILS_MODULE_H
 static const int MODUTILS_MODULE_H = 1;
 
-#ident "$Id: insmod.c,v 1.42 2001/01/26 02:23:57 andersen Exp $"
+#ident "$Id: insmod.c,v 1.43 2001/01/27 08:24:37 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
@@ -284,7 +287,7 @@ int delete_module(const char *);
 #ifndef MODUTILS_OBJ_H
 static const int MODUTILS_OBJ_H = 1;
 
-#ident "$Id: insmod.c,v 1.42 2001/01/26 02:23:57 andersen Exp $"
+#ident "$Id: insmod.c,v 1.43 2001/01/27 08:24:37 andersen Exp $"
 
 /* The relocatable object is manipulated using elfin types.  */
 
diff --git a/kill.c b/kill.c
index 19ca187..3eb829a 100644 (file)
--- a/kill.c
+++ b/kill.c
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <signal.h>
 #include <ctype.h>
+#include <string.h>
 #include <unistd.h>
 
 static const int KILL = 0;
diff --git a/ln.c b/ln.c
index e69cb02..d6bf644 100644 (file)
--- a/ln.c
+++ b/ln.c
 
 #include <stdio.h>
 #include <dirent.h>
+#include <string.h>
+#include <stdlib.h>
 #include <errno.h>
+#include <unistd.h>
 
 static const int LN_SYMLINK = 1;
 static const int LN_FORCE = 2;
index 43c1cc7..75b40da 100644 (file)
@@ -24,6 +24,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 
 #define BINARY_KEYMAP_MAGIC "bkeymap"
index 3d02979..d286f34 100644 (file)
--- a/logger.c
+++ b/logger.c
@@ -27,6 +27,8 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 
 #if !defined BB_SYSLOGD
 
index d614e85..edec016 100644 (file)
--- a/logname.c
+++ b/logname.c
@@ -22,6 +22,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 extern int logname_main(int argc, char **argv)
 {
diff --git a/ls.c b/ls.c
index 4b225d6..affa48c 100644 (file)
--- a/ls.c
+++ b/ls.c
@@ -59,6 +59,7 @@ static const int COLUMN_GAP = 2;                      /* includes the file type char, if present */
 #include <time.h>
 #endif
 #include <string.h>
+#include <stdlib.h>
 
 #include <fcntl.h>
 #include <signal.h>
index efd15df..7e1d2ee 100644 (file)
@@ -21,6 +21,8 @@
 #define bb_need_io_error
 #include "messages.c"
 #include <utmp.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 extern int dutmp_main(int argc, char **argv)
 {
@@ -35,7 +37,7 @@ extern int dutmp_main(int argc, char **argv)
        } else  {
                file = open(argv[1], O_RDONLY);
                if (file < 0) {
-                       error_msg_and_die(io_error, argv[1], strerror(errno));
+                       perror_msg_and_die(io_error, argv[1]);
                }
        }
 
index 2d53cc2..3b9f2b2 100644 (file)
@@ -25,6 +25,8 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int mktemp_main(int argc, char **argv)
 {
index 70d03cc..0d28339 100644 (file)
@@ -1,6 +1,7 @@
 /* vi: set sw=4 ts=4: */
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/mtio.h>
 #include <sys/fcntl.h>
 
index bb2056a..98f1dea 100644 (file)
@@ -25,6 +25,7 @@
 #include "busybox.h"
 #include <errno.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 int readlink_main(int argc, char **argv)
 {
index 080cb99..309ce0c 100644 (file)
 #include <sys/param.h>
 #include <sys/syslog.h>
 #include <unistd.h> /* for getopt() */
+#include <stdlib.h>
 
 
 #if defined(__GLIBC__)
 #include <sys/kdaemon.h>
 #else
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 static _syscall2(int, bdflush, int, func, int, data);
 #endif /* __GLIBC__ */
 
index d297afa..7026cc0 100644 (file)
@@ -23,6 +23,8 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int watchdog_main(int argc, char **argv)
 {
diff --git a/mkdir.c b/mkdir.c
index 92357a6..eb6e7db 100644 (file)
--- a/mkdir.c
+++ b/mkdir.c
@@ -28,6 +28,8 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
+#include <stdlib.h>
 
 static int parentFlag = FALSE;
 static mode_t mode = 0777;
index 728e1ec..b31e6f1 100644 (file)
--- a/mkfifo.c
+++ b/mkfifo.c
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <errno.h>
+#include <stdlib.h>
 
 extern int mkfifo_main(int argc, char **argv)
 {
diff --git a/mknod.c b/mknod.c
index 4d8c598..c761aea 100644 (file)
--- a/mknod.c
+++ b/mknod.c
@@ -26,6 +26,8 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 
 int mknod_main(int argc, char **argv)
 {
index 2d53cc2..3b9f2b2 100644 (file)
--- a/mktemp.c
+++ b/mktemp.c
@@ -25,6 +25,8 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int mktemp_main(int argc, char **argv)
 {
index 6ac2dcd..b82728a 100644 (file)
 #include <dirent.h>
 #include <ctype.h>
 #include <assert.h>
+#include <string.h>
 #include <getopt.h>
 #include <sys/utsname.h>
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 
 //----------------------------------------------------------------------------
 //--------modutils module.h, lines 45-242
@@ -78,7 +81,7 @@
 #ifndef MODUTILS_MODULE_H
 static const int MODUTILS_MODULE_H = 1;
 
-#ident "$Id: insmod.c,v 1.42 2001/01/26 02:23:57 andersen Exp $"
+#ident "$Id: insmod.c,v 1.43 2001/01/27 08:24:37 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
@@ -284,7 +287,7 @@ int delete_module(const char *);
 #ifndef MODUTILS_OBJ_H
 static const int MODUTILS_OBJ_H = 1;
 
-#ident "$Id: insmod.c,v 1.42 2001/01/26 02:23:57 andersen Exp $"
+#ident "$Id: insmod.c,v 1.43 2001/01/27 08:24:37 andersen Exp $"
 
 /* The relocatable object is manipulated using elfin types.  */
 
index 52adc7b..ff08c4c 100644 (file)
@@ -25,6 +25,9 @@
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
+#include <stdlib.h>
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 #define __LIBRARY__
 
 
diff --git a/more.c b/more.c
index 03cb3bc..c4c74fe 100644 (file)
--- a/more.c
+++ b/more.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <stdlib.h>
 #include <sys/ioctl.h>
 #define BB_DECLARE_EXTERN
 #define bb_need_help
diff --git a/mt.c b/mt.c
index 70d03cc..0d28339 100644 (file)
--- a/mt.c
+++ b/mt.c
@@ -1,6 +1,7 @@
 /* vi: set sw=4 ts=4: */
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/mtio.h>
 #include <sys/fcntl.h>
 
index b1f0613..a789fa0 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: hostname.c,v 1.20 2001/01/24 18:44:54 andersen Exp $
+ * $Id: hostname.c,v 1.21 2001/01/27 08:24:37 andersen Exp $
  * Mini hostname implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -28,6 +28,7 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <unistd.h>
+#include <string.h>
 #include <stdio.h>
 
 void do_sethostname(char *s, int isfile)
index 271518f..1f37e31 100644 (file)
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include <netdb.h>
 #include <sys/socket.h>
@@ -169,4 +170,4 @@ int nslookup_main(int argc, char **argv)
        return EXIT_SUCCESS;
 }
 
-/* $Id: nslookup.c,v 1.18 2001/01/24 18:44:54 andersen Exp $ */
+/* $Id: nslookup.c,v 1.19 2001/01/27 08:24:37 andersen Exp $ */
index 37ca26f..a2e9163 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: ping.c,v 1.34 2001/01/24 18:44:54 andersen Exp $
+ * $Id: ping.c,v 1.35 2001/01/27 08:24:37 andersen Exp $
  * Mini ping implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -47,6 +47,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 
 
 /* It turns out that libc5 doesn't have proper icmp support
index 2c38cb0..438ecba 100644 (file)
 #include <arpa/inet.h>
 #include <netdb.h>
 
+/* Stupid libc5 doesn't define this... */
+#ifndef timersub
+#define        timersub(a, b, result)                                                \
+  do {                                                                       \
+    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;                            \
+    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;                         \
+    if ((result)->tv_usec < 0) {                                             \
+      --(result)->tv_sec;                                                    \
+      (result)->tv_usec += 1000000;                                          \
+    }                                                                        \
+  } while (0)
+#endif 
 
 void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path);
 FILE *open_socket(char *host, int port);
@@ -283,7 +295,7 @@ FILE *open_socket(char *host, int port)
        int fd;
        FILE *fp;
 
-       memzero(&sin, sizeof(sin));
+       memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
        if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
                error_msg_and_die("cannot resolve %s\n", host);
@@ -521,7 +533,7 @@ progressmeter(int flag)
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     $Id: wget.c,v 1.22 2001/01/26 02:04:49 andersen Exp $
+ *     $Id: wget.c,v 1.23 2001/01/27 08:24:38 andersen Exp $
  */
 
 
index 271518f..1f37e31 100644 (file)
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include <netdb.h>
 #include <sys/socket.h>
@@ -169,4 +170,4 @@ int nslookup_main(int argc, char **argv)
        return EXIT_SUCCESS;
 }
 
-/* $Id: nslookup.c,v 1.18 2001/01/24 18:44:54 andersen Exp $ */
+/* $Id: nslookup.c,v 1.19 2001/01/27 08:24:37 andersen Exp $ */
diff --git a/ping.c b/ping.c
index 37ca26f..a2e9163 100644 (file)
--- a/ping.c
+++ b/ping.c
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: ping.c,v 1.34 2001/01/24 18:44:54 andersen Exp $
+ * $Id: ping.c,v 1.35 2001/01/27 08:24:37 andersen Exp $
  * Mini ping implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -47,6 +47,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 
 
 /* It turns out that libc5 doesn't have proper icmp support
index f2e746e..4dd99ab 100644 (file)
@@ -24,6 +24,7 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <errno.h>
+#include <stdlib.h>
 
 extern int free_main(int argc, char **argv)
 {
index 19ca187..3eb829a 100644 (file)
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <signal.h>
 #include <ctype.h>
+#include <string.h>
 #include <unistd.h>
 
 static const int KILL = 0;
index cb4c21e..aac064c 100644 (file)
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <string.h>
 #include <sys/ioctl.h>
 #define BB_DECLARE_EXTERN
 #define bb_need_help
index 8f06181..9d85ba0 100644 (file)
@@ -23,6 +23,7 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 
index b827f7e..4463b94 100644 (file)
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <time.h>
 #include <errno.h>
+#include <stdlib.h>
 
 static const int FSHIFT = 16;              /* nr of bits of precision */
 #define FIXED_1         (1<<FSHIFT)     /* 1.0 as fixed-point */
diff --git a/ps.c b/ps.c
index cb4c21e..aac064c 100644 (file)
--- a/ps.c
+++ b/ps.c
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <string.h>
 #include <sys/ioctl.h>
 #define BB_DECLARE_EXTERN
 #define bb_need_help
diff --git a/pwd.c b/pwd.c
index da089f3..a9acbc7 100644 (file)
--- a/pwd.c
+++ b/pwd.c
@@ -25,6 +25,8 @@
 #include <stdio.h>
 #include <dirent.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int pwd_main(int argc, char **argv)
 {
diff --git a/rdate.c b/rdate.c
index 954982a..0ad339b 100644 (file)
--- a/rdate.c
+++ b/rdate.c
@@ -31,6 +31,8 @@
 #include <netdb.h>
 #include <stdio.h>
 #include <getopt.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 
 static const int RFC_868_BIAS = 2208988800UL;
index bb2056a..98f1dea 100644 (file)
@@ -25,6 +25,7 @@
 #include "busybox.h"
 #include <errno.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 int readlink_main(int argc, char **argv)
 {
index 8f06181..9d85ba0 100644 (file)
--- a/renice.c
+++ b/renice.c
@@ -23,6 +23,7 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 
diff --git a/reset.c b/reset.c
index bf8c3ed..861bd43 100644 (file)
--- a/reset.c
+++ b/reset.c
@@ -25,6 +25,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 
 extern int reset_main(int argc, char **argv)
 {
diff --git a/rm.c b/rm.c
index a9501ec..302599e 100644 (file)
--- a/rm.c
+++ b/rm.c
@@ -28,6 +28,8 @@
 #include <utime.h>
 #include <dirent.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 static int recursiveFlag = FALSE;
 static int forceFlag = FALSE;
diff --git a/rmdir.c b/rmdir.c
index f9f82bb..8c2165e 100644 (file)
--- a/rmdir.c
+++ b/rmdir.c
@@ -25,6 +25,8 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int rmdir_main(int argc, char **argv)
 {
diff --git a/rmmod.c b/rmmod.c
index 52adc7b..ff08c4c 100644 (file)
--- a/rmmod.c
+++ b/rmmod.c
@@ -25,6 +25,9 @@
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
+#include <stdlib.h>
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 #define __LIBRARY__
 
 
index 0f36077..85c7c9c 100644 (file)
@@ -15,6 +15,9 @@
  
 #include "busybox.h" 
 #include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
 
 /*
  * Some general definitions
diff --git a/sed.c b/sed.c
index a50d8d0..95aad79 100644 (file)
--- a/sed.c
+++ b/sed.c
 #include <string.h> /* for strdup() */
 #include <errno.h>
 #include <ctype.h> /* for isspace() */
+#include <stdlib.h>
 #include "busybox.h"
 
 /* externs */
+extern void xregcomp(regex_t *preg, const char *regex, int cflags);
 extern int optind; /* in unistd.h */
 extern char *optarg; /* ditto */
 
diff --git a/sleep.c b/sleep.c
index 10eca59..61b7ce4 100644 (file)
--- a/sleep.c
+++ b/sleep.c
@@ -23,6 +23,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int sleep_main(int argc, char **argv)
 {
diff --git a/sort.c b/sort.c
index efff6b6..2aef2d9 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -22,6 +22,8 @@
  */
 
 #include "busybox.h"
+#include <getopt.h>
+#include <stdlib.h>
 
 int compare_ascii(const void *x, const void *y)
 {
index eda1510..d792c70 100644 (file)
 
 #include "busybox.h"
 #include <stdio.h>
-#include <sys/mount.h>
 #include <mntent.h>
 #include <dirent.h>
 #include <errno.h>
+#include <stdlib.h>
+#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 
 _syscall2(int, swapon, const char *, path, int, flags);
 _syscall1(int, swapoff, const char *, path);
diff --git a/sync.c b/sync.c
index 8f101cf..f95c24c 100644 (file)
--- a/sync.c
+++ b/sync.c
@@ -23,6 +23,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <unistd.h>
 
 extern int sync_main(int argc, char **argv)
 {
index 3d02979..d286f34 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 
 #if !defined BB_SYSLOGD
 
index 972fda1..3c36f68 100644 (file)
@@ -34,6 +34,7 @@
 #include <signal.h>
 #include <stdarg.h>
 #include <time.h>
+#include <string.h>
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/types.h>
@@ -41,7 +42,8 @@
 #include <sys/param.h>
 
 #if ! defined __GLIBC__ && ! defined __UCLIBC__
-
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 typedef unsigned int socklen_t;
 
 #ifndef __alpha__
index 972fda1..3c36f68 100644 (file)
--- a/syslogd.c
+++ b/syslogd.c
@@ -34,6 +34,7 @@
 #include <signal.h>
 #include <stdarg.h>
 #include <time.h>
+#include <string.h>
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/types.h>
@@ -41,7 +42,8 @@
 #include <sys/param.h>
 
 #if ! defined __GLIBC__ && ! defined __UCLIBC__
-
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 typedef unsigned int socklen_t;
 
 #ifndef __alpha__
diff --git a/tail.c b/tail.c
index dc5918d..40511aa 100644 (file)
--- a/tail.c
+++ b/tail.c
 
 #include "busybox.h"
 
-#include <sys/types.h>
 #include <fcntl.h>
+#include <getopt.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
 
 static struct suffix_mult tail_suffixes[] = {
        { "b", 512 },
diff --git a/tar.c b/tar.c
index 51a857d..2c7169b 100644 (file)
--- a/tar.c
+++ b/tar.c
@@ -52,6 +52,9 @@
 #include <sys/sysmacros.h>
 #include <getopt.h>
 #include <fnmatch.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #ifdef BB_FEATURE_TAR_GZIP
 extern int unzip(int in, int out);
diff --git a/touch.c b/touch.c
index 1b03075..fa2f3b6 100644 (file)
--- a/touch.c
+++ b/touch.c
@@ -28,6 +28,8 @@
 #include <fcntl.h>
 #include <utime.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int touch_main(int argc, char **argv)
 {
diff --git a/tr.c b/tr.c
index 15e3709..2717a92 100644 (file)
--- a/tr.c
+++ b/tr.c
@@ -191,9 +191,9 @@ extern int tr_main(int argc, char **argv)
                        map(input, input_length, output, output_length);
                }
                for (i = 0; i < input_length; i++)
-                       invec[input[i]] = TRUE;
+                       invec[(int)input[i]] = TRUE;
                for (i = 0; i < output_length; i++)
-                       outvec[output[i]] = TRUE;
+                       outvec[(int)output[i]] = TRUE;
        }
        convert();
        return (0);
index 333541c..155b262 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include "busybox.h"
+#include <stdlib.h>
 
 
 extern int true_main(int argc, char **argv)
diff --git a/tty.c b/tty.c
index 46201d3..2a64b14 100644 (file)
--- a/tty.c
+++ b/tty.c
@@ -22,6 +22,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <sys/types.h>
 
 extern int tty_main(int argc, char **argv)
index 2e2d95d..dfd5825 100644 (file)
--- a/umount.c
+++ b/umount.c
@@ -26,6 +26,8 @@
 #include <stdio.h>
 #include <mntent.h>
 #include <errno.h>
+#include <string.h>
+#include <stdlib.h>
 
 
 static const int MNT_FORCE = 1;
diff --git a/uname.c b/uname.c
index 4f7c643..deaffd7 100644 (file)
--- a/uname.c
+++ b/uname.c
@@ -33,6 +33,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
 
diff --git a/uniq.c b/uniq.c
index c0229ae..2288559 100644 (file)
--- a/uniq.c
+++ b/uniq.c
@@ -26,7 +26,9 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <string.h>
+#include <getopt.h>
 #include <errno.h>
+#include <stdlib.h>
 
 static int print_count;
 static int print_uniq = 1;
index 080cb99..309ce0c 100644 (file)
--- a/update.c
+++ b/update.c
 #include <sys/param.h>
 #include <sys/syslog.h>
 #include <unistd.h> /* for getopt() */
+#include <stdlib.h>
 
 
 #if defined(__GLIBC__)
 #include <sys/kdaemon.h>
 #else
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 static _syscall2(int, bdflush, int, func, int, data);
 #endif /* __GLIBC__ */
 
index b827f7e..4463b94 100644 (file)
--- a/uptime.c
+++ b/uptime.c
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <time.h>
 #include <errno.h>
+#include <stdlib.h>
 
 static const int FSHIFT = 16;              /* nr of bits of precision */
 #define FIXED_1         (1<<FSHIFT)     /* 1.0 as fixed-point */
index c220d90..c21f84c 100644 (file)
 #include "busybox.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <getopt.h>
 
 #if __GNU_LIBRARY__ < 5
-
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 #ifndef __alpha__
 # define __NR_klogctl __NR_syslog
 static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
index 845be84..637896b 100644 (file)
@@ -31,6 +31,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
+#include <string.h>
 #include <sys/ioctl.h>
 
 #define DEFAULTFBDEV  "/dev/fb0"
index 5eb93dd..fcf8ddd 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 /* From <linux/fd.h> */
 #define FDFLUSH  _IO(2,0x4b)
index a2b17c6..8f90f40 100644 (file)
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <errno.h>
+#include <stdlib.h>
 #include "busybox.h"
 
 
index 03cb3bc..c4c74fe 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <stdlib.h>
 #include <sys/ioctl.h>
 #define BB_DECLARE_EXTERN
 #define bb_need_help
index 954982a..0ad339b 100644 (file)
@@ -31,6 +31,8 @@
 #include <netdb.h>
 #include <stdio.h>
 #include <getopt.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 
 static const int RFC_868_BIAS = 2208988800UL;
index eda1510..d792c70 100644 (file)
 
 #include "busybox.h"
 #include <stdio.h>
-#include <sys/mount.h>
 #include <mntent.h>
 #include <dirent.h>
 #include <errno.h>
+#include <stdlib.h>
+#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <linux/unistd.h>
 
 _syscall2(int, swapon, const char *, path, int, flags);
 _syscall1(int, swapoff, const char *, path);
index 2e2d95d..dfd5825 100644 (file)
@@ -26,6 +26,8 @@
 #include <stdio.h>
 #include <mntent.h>
 #include <errno.h>
+#include <string.h>
+#include <stdlib.h>
 
 
 static const int MNT_FORCE = 1;
index 13b8065..bf4284c 100644 (file)
--- a/utility.c
+++ b/utility.c
 #include <utime.h>
 #include <unistd.h>
 #include <ctype.h>
+#include <stdlib.h>
 #include <sys/ioctl.h>
 #include <sys/utsname.h>               /* for uname(2) */
+
 #include "pwd_grp/pwd.h"
 #include "pwd_grp/grp.h"
 
+/* for the _syscall() macros */
+#include <sys/syscall.h>
+#include <linux/unistd.h>
+
 /* Busybox mount uses either /proc/filesystems or /dev/mtab to get the 
  * list of available filesystems used for the -t auto option */ 
 #if defined BB_FEATURE_USE_PROCFS && defined BB_FEATURE_USE_DEVPS_PATCH
@@ -1123,6 +1129,7 @@ extern int check_wildcard_match(const char *text, const char *pattern)
 
 
 #if defined BB_DF || defined BB_MTAB
+#include <mntent.h>
 /*
  * Given a block device, find the mount table entry if that block device
  * is mounted.
@@ -1645,6 +1652,7 @@ char *get_last_path_component(char *path)
 #endif
 
 #if defined BB_GREP || defined BB_SED
+#include <regex.h>
 void xregcomp(regex_t *preg, const char *regex, int cflags)
 {
        int ret;
index 7b26d2d..fcfcfd9 100644 (file)
 #include <stdio.h>
 #include <errno.h>
 #include <getopt.h>
+#include <string.h>
+#include <stdlib.h>
+#include "pwd_grp/pwd.h"
+#include "pwd_grp/grp.h"
 
 /*struct passwd *getpwnam();*/
 
index 24aabd3..5df4902 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <getopt.h>
+#include <stdlib.h>
 
 #define        RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
 
index d297afa..7026cc0 100644 (file)
@@ -23,6 +23,8 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int watchdog_main(int argc, char **argv)
 {
diff --git a/wc.c b/wc.c
index e6f7534..619c161 100644 (file)
--- a/wc.c
+++ b/wc.c
@@ -23,6 +23,7 @@
 #include "busybox.h"
 #include <stdio.h>
 #include <getopt.h>
+#include <stdlib.h>
 
 static int total_lines, total_words, total_chars, max_length;
 static int print_lines, print_words, print_chars, print_length;
diff --git a/wget.c b/wget.c
index 2c38cb0..438ecba 100644 (file)
--- a/wget.c
+++ b/wget.c
 #include <arpa/inet.h>
 #include <netdb.h>
 
+/* Stupid libc5 doesn't define this... */
+#ifndef timersub
+#define        timersub(a, b, result)                                                \
+  do {                                                                       \
+    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;                            \
+    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;                         \
+    if ((result)->tv_usec < 0) {                                             \
+      --(result)->tv_sec;                                                    \
+      (result)->tv_usec += 1000000;                                          \
+    }                                                                        \
+  } while (0)
+#endif 
 
 void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path);
 FILE *open_socket(char *host, int port);
@@ -283,7 +295,7 @@ FILE *open_socket(char *host, int port)
        int fd;
        FILE *fp;
 
-       memzero(&sin, sizeof(sin));
+       memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
        if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
                error_msg_and_die("cannot resolve %s\n", host);
@@ -521,7 +533,7 @@ progressmeter(int flag)
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     $Id: wget.c,v 1.22 2001/01/26 02:04:49 andersen Exp $
+ *     $Id: wget.c,v 1.23 2001/01/27 08:24:38 andersen Exp $
  */
 
 
diff --git a/which.c b/which.c
index a92777e..b900a0b 100644 (file)
--- a/which.c
+++ b/which.c
@@ -22,7 +22,9 @@
  */
 
 #include "busybox.h"
+#include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 extern int which_main(int argc, char **argv)
 {
index d7f0a17..870ede4 100644 (file)
--- a/whoami.c
+++ b/whoami.c
@@ -22,6 +22,8 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 extern int whoami_main(int argc, char **argv)
 {
diff --git a/yes.c b/yes.c
index 46873f3..0ce4949 100644 (file)
--- a/yes.c
+++ b/yes.c
@@ -22,6 +22,7 @@
 
 #include "busybox.h"
 #include <stdio.h>
+#include <stdlib.h>
 
 extern int yes_main(int argc, char **argv)
 {