summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-02-20 06:14:08 +0000
committerEric Andersen <andersen@codepoet.org>2001-02-20 06:14:08 +0000
commitcbe31dace5fb24304694d399b9eb267fbe752516 (patch)
tree49d1bb722d95eb1aded6b5d354ac86e56c481c10
parent94456f598417f2f61edb97b5ab67ddfdc408ad10 (diff)
downloadbusybox-w32-cbe31dace5fb24304694d399b9eb267fbe752516.tar.gz
busybox-w32-cbe31dace5fb24304694d399b9eb267fbe752516.tar.bz2
busybox-w32-cbe31dace5fb24304694d399b9eb267fbe752516.zip
It turns out that DODMALLOC was broken when I reorganized busybox.h
header file usage before the 0.49 release. To fix it, I had to move the '#include "busybox.h"' to the end of the list of #include files. -Erik
-rw-r--r--applets/busybox.c2
-rw-r--r--archival/gunzip.c2
-rw-r--r--archival/gzip.c23
-rw-r--r--archival/tar.c10
-rw-r--r--basename.c2
-rw-r--r--busybox.c2
-rw-r--r--cat.c2
-rw-r--r--chmod_chown_chgrp.c8
-rw-r--r--chroot.c2
-rw-r--r--chvt.c2
-rw-r--r--clear.c2
-rw-r--r--cmdedit.c30
-rw-r--r--cmp.c2
-rw-r--r--console-tools/chvt.c2
-rw-r--r--console-tools/clear.c2
-rw-r--r--console-tools/deallocvt.c2
-rw-r--r--console-tools/dumpkmap.c2
-rw-r--r--console-tools/loadacm.c4
-rw-r--r--console-tools/loadfont.c2
-rw-r--r--console-tools/loadkmap.c2
-rw-r--r--console-tools/reset.c2
-rw-r--r--console-tools/setkeycodes.c2
-rw-r--r--coreutils/basename.c2
-rw-r--r--coreutils/cat.c2
-rw-r--r--coreutils/chroot.c2
-rw-r--r--coreutils/cmp.c2
-rw-r--r--coreutils/date.c10
-rw-r--r--coreutils/dd.c4
-rw-r--r--coreutils/df.c2
-rw-r--r--coreutils/dirname.c3
-rw-r--r--coreutils/dos2unix.c2
-rw-r--r--coreutils/du.c12
-rw-r--r--coreutils/echo.c2
-rw-r--r--coreutils/expr.c2
-rw-r--r--coreutils/head.c2
-rw-r--r--coreutils/hostid.c2
-rw-r--r--coreutils/length.c2
-rw-r--r--coreutils/ln.c10
-rw-r--r--coreutils/logname.c2
-rw-r--r--coreutils/ls.c2
-rw-r--r--coreutils/md5sum.c2
-rw-r--r--coreutils/mkdir.c8
-rw-r--r--coreutils/mkfifo.c2
-rw-r--r--coreutils/mknod.c4
-rw-r--r--coreutils/printf.c2
-rw-r--r--coreutils/pwd.c2
-rw-r--r--coreutils/rm.c2
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/sleep.c2
-rw-r--r--coreutils/sort.c2
-rw-r--r--coreutils/stty.c2
-rw-r--r--coreutils/sync.c2
-rw-r--r--coreutils/tail.c2
-rw-r--r--coreutils/test.c2
-rw-r--r--coreutils/touch.c2
-rw-r--r--coreutils/tr.c2
-rw-r--r--coreutils/tty.c2
-rw-r--r--coreutils/uname.c2
-rw-r--r--coreutils/uniq.c2
-rw-r--r--coreutils/usleep.c2
-rw-r--r--coreutils/uudecode.c2
-rw-r--r--coreutils/uuencode.c2
-rw-r--r--coreutils/wc.c2
-rw-r--r--coreutils/whoami.c2
-rw-r--r--coreutils/yes.c2
-rw-r--r--cp_mv.c14
-rw-r--r--date.c10
-rw-r--r--dc.c2
-rw-r--r--dd.c4
-rw-r--r--deallocvt.c2
-rw-r--r--df.c2
-rw-r--r--dirname.c3
-rw-r--r--dmesg.c2
-rw-r--r--dos2unix.c2
-rw-r--r--du.c12
-rw-r--r--dumpkmap.c2
-rw-r--r--dutmp.c8
-rw-r--r--echo.c2
-rw-r--r--expr.c2
-rw-r--r--fbset.c2
-rw-r--r--fdflush.c2
-rw-r--r--find.c2
-rw-r--r--findutils/find.c2
-rw-r--r--findutils/which.c2
-rw-r--r--findutils/xargs.c2
-rw-r--r--free.c2
-rw-r--r--fsck_minix.c2
-rw-r--r--gunzip.c2
-rw-r--r--gzip.c23
-rw-r--r--head.c2
-rw-r--r--hostid.c2
-rw-r--r--ifconfig.c6
-rw-r--r--init.c8
-rw-r--r--init/init.c8
-rw-r--r--insmod.c6
-rw-r--r--kill.c2
-rw-r--r--length.c2
-rw-r--r--ln.c10
-rw-r--r--loadacm.c4
-rw-r--r--loadfont.c2
-rw-r--r--loadkmap.c2
-rw-r--r--logger.c3
-rw-r--r--logname.c2
-rw-r--r--ls.c2
-rw-r--r--lsmod.c2
-rw-r--r--makedevs.c2
-rw-r--r--md5sum.c2
-rw-r--r--miscutils/dc.c2
-rw-r--r--miscutils/dutmp.c8
-rw-r--r--miscutils/makedevs.c2
-rw-r--r--miscutils/mktemp.c2
-rw-r--r--miscutils/mt.c2
-rw-r--r--miscutils/readlink.c2
-rw-r--r--miscutils/update.c2
-rw-r--r--miscutils/watchdog.c2
-rw-r--r--mkdir.c8
-rw-r--r--mkfifo.c2
-rw-r--r--mkfs_minix.c2
-rw-r--r--mknod.c4
-rw-r--r--mkswap.c2
-rw-r--r--mktemp.c2
-rw-r--r--modutils/insmod.c6
-rw-r--r--modutils/lsmod.c2
-rw-r--r--modutils/rmmod.c2
-rw-r--r--more.c2
-rw-r--r--mount.c2
-rw-r--r--mt.c2
-rw-r--r--mtab.c2
-rw-r--r--nc.c2
-rw-r--r--networking/ifconfig.c6
-rw-r--r--networking/nc.c2
-rw-r--r--networking/nslookup.c4
-rw-r--r--networking/ping.c4
-rw-r--r--networking/route.c4
-rw-r--r--networking/telnet.c2
-rw-r--r--networking/wget.c5
-rw-r--r--nfsmount.c16
-rw-r--r--nslookup.c4
-rw-r--r--ping.c4
-rw-r--r--pivot_root.c2
-rw-r--r--printf.c2
-rw-r--r--procps/free.c2
-rw-r--r--procps/kill.c2
-rw-r--r--procps/ps.c2
-rw-r--r--procps/renice.c2
-rw-r--r--procps/uptime.c2
-rw-r--r--ps.c2
-rw-r--r--pwd.c2
-rw-r--r--rdate.c6
-rw-r--r--readlink.c2
-rw-r--r--renice.c2
-rw-r--r--reset.c2
-rw-r--r--rm.c2
-rw-r--r--rmdir.c2
-rw-r--r--rmmod.c2
-rw-r--r--route.c4
-rw-r--r--rpmunpack.c2
-rw-r--r--setkeycodes.c2
-rw-r--r--shell/cmdedit.c30
-rw-r--r--sleep.c2
-rw-r--r--sort.c2
-rw-r--r--stty.c2
-rw-r--r--swaponoff.c2
-rw-r--r--sync.c2
-rw-r--r--sysklogd/logger.c3
-rw-r--r--sysklogd/syslogd.c2
-rw-r--r--syslogd.c2
-rw-r--r--tail.c2
-rw-r--r--tar.c10
-rw-r--r--telnet.c2
-rw-r--r--test.c2
-rw-r--r--touch.c2
-rw-r--r--tr.c2
-rw-r--r--true_false.c2
-rw-r--r--tty.c2
-rw-r--r--umount.c2
-rw-r--r--uname.c2
-rw-r--r--uniq.c2
-rw-r--r--update.c2
-rw-r--r--uptime.c2
-rw-r--r--usleep.c2
-rw-r--r--util-linux/dmesg.c2
-rw-r--r--util-linux/fbset.c2
-rw-r--r--util-linux/fdflush.c2
-rw-r--r--util-linux/fsck_minix.c2
-rw-r--r--util-linux/mkfs_minix.c2
-rw-r--r--util-linux/mkswap.c2
-rw-r--r--util-linux/more.c2
-rw-r--r--util-linux/mount.c2
-rw-r--r--util-linux/nfsmount.c16
-rw-r--r--util-linux/pivot_root.c2
-rw-r--r--util-linux/rdate.c6
-rw-r--r--util-linux/swaponoff.c2
-rw-r--r--util-linux/umount.c2
-rw-r--r--utility.c28
-rw-r--r--uudecode.c2
-rw-r--r--uuencode.c2
-rw-r--r--watchdog.c2
-rw-r--r--wc.c2
-rw-r--r--wget.c5
-rw-r--r--which.c2
-rw-r--r--whoami.c2
-rw-r--r--xargs.c2
-rw-r--r--yes.c2
204 files changed, 362 insertions, 378 deletions
diff --git a/applets/busybox.c b/applets/busybox.c
index 6c1070fc8..5fec3d5ec 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -1,10 +1,10 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <stdio.h> 2#include <stdio.h>
4#include <string.h> 3#include <string.h>
5#include <unistd.h> 4#include <unistd.h>
6#include <errno.h> 5#include <errno.h>
7#include <stdlib.h> 6#include <stdlib.h>
7#include "busybox.h"
8 8
9#undef APPLET 9#undef APPLET
10#undef APPLET_NOUSAGE 10#undef APPLET_NOUSAGE
diff --git a/archival/gunzip.c b/archival/gunzip.c
index bf8812dbd..8100003ec 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -57,7 +57,6 @@ static char *license_msg[] = {
57}; 57};
58#endif 58#endif
59 59
60#include "busybox.h"
61#include <getopt.h> 60#include <getopt.h>
62#include <ctype.h> 61#include <ctype.h>
63#include <sys/types.h> 62#include <sys/types.h>
@@ -71,6 +70,7 @@ static char *license_msg[] = {
71#include <stdlib.h> 70#include <stdlib.h>
72#include <time.h> 71#include <time.h>
73#include <dirent.h> 72#include <dirent.h>
73#include "busybox.h"
74#define BB_DECLARE_EXTERN 74#define BB_DECLARE_EXTERN
75#define bb_need_memory_exhausted 75#define bb_need_memory_exhausted
76#define bb_need_name_too_long 76#define bb_need_name_too_long
diff --git a/archival/gzip.c b/archival/gzip.c
index 3cbef4ec1..6c058d2b6 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -29,11 +29,6 @@
29 * 29 *
30 */ 30 */
31 31
32#include "busybox.h"
33#define BB_DECLARE_EXTERN
34#define bb_need_memory_exhausted
35#include "messages.c"
36
37/* These defines are very important for BusyBox. Without these, 32/* These defines are very important for BusyBox. Without these,
38 * huge chunks of ram are pre-allocated making the BusyBox bss 33 * huge chunks of ram are pre-allocated making the BusyBox bss
39 * size Freaking Huge(tm), which is a bad thing.*/ 34 * size Freaking Huge(tm), which is a bad thing.*/
@@ -43,9 +38,15 @@
43/* I don't like nested includes, but the string and io functions are used 38/* I don't like nested includes, but the string and io functions are used
44 * too often 39 * too often
45 */ 40 */
41#include <stdlib.h>
46#include <stdio.h> 42#include <stdio.h>
47#include <string.h> 43#include <string.h>
48#include <unistd.h> 44#include <unistd.h>
45#include "busybox.h"
46#define BB_DECLARE_EXTERN
47#define bb_need_memory_exhausted
48#include "messages.c"
49
49#define memzero(s, n) memset ((void *)(s), 0, (n)) 50#define memzero(s, n) memset ((void *)(s), 0, (n))
50 51
51#ifndef RETSIGTYPE 52#ifndef RETSIGTYPE
@@ -1628,12 +1629,6 @@ ulg deflate()
1628# include <unistd.h> 1629# include <unistd.h>
1629#endif 1630#endif
1630 1631
1631#if defined(STDC_HEADERS) || !defined(NO_STDLIB_H)
1632# include <stdlib.h>
1633#else
1634extern int errno;
1635#endif
1636
1637#if defined(DIRENT) 1632#if defined(DIRENT)
1638# include <dirent.h> 1633# include <dirent.h>
1639typedef struct dirent dir_type; 1634typedef struct dirent dir_type;
@@ -3098,12 +3093,6 @@ local void set_file_type()
3098# include <fcntl.h> 3093# include <fcntl.h>
3099#endif 3094#endif
3100 3095
3101#if defined(STDC_HEADERS) || !defined(NO_STDLIB_H)
3102# include <stdlib.h>
3103#else
3104extern int errno;
3105#endif
3106
3107/* =========================================================================== 3096/* ===========================================================================
3108 * Copy input to output unchanged: zcat == cat with --force. 3097 * Copy input to output unchanged: zcat == cat with --force.
3109 * IN assertion: insize bytes have already been read in inbuf. 3098 * IN assertion: insize bytes have already been read in inbuf.
diff --git a/archival/tar.c b/archival/tar.c
index 62f1b1d35..a9363d5ad 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -36,11 +36,6 @@
36 */ 36 */
37 37
38 38
39#include "busybox.h"
40#define BB_DECLARE_EXTERN
41#define bb_need_io_error
42#define bb_need_name_longer_than_foo
43#include "messages.c"
44#include <stdio.h> 39#include <stdio.h>
45#include <dirent.h> 40#include <dirent.h>
46#include <errno.h> 41#include <errno.h>
@@ -55,6 +50,11 @@
55#include <string.h> 50#include <string.h>
56#include <stdlib.h> 51#include <stdlib.h>
57#include <unistd.h> 52#include <unistd.h>
53#include "busybox.h"
54#define BB_DECLARE_EXTERN
55#define bb_need_io_error
56#define bb_need_name_longer_than_foo
57#include "messages.c"
58 58
59#ifdef BB_FEATURE_TAR_GZIP 59#ifdef BB_FEATURE_TAR_GZIP
60extern int unzip(int in, int out); 60extern int unzip(int in, int out);
diff --git a/basename.c b/basename.c
index da59a8672..da0b7ecc3 100644
--- a/basename.c
+++ b/basename.c
@@ -21,8 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdlib.h> 24#include <stdlib.h>
25#include "busybox.h"
26#include <string.h> 26#include <string.h>
27 27
28extern int basename_main(int argc, char **argv) 28extern int basename_main(int argc, char **argv)
diff --git a/busybox.c b/busybox.c
index 6c1070fc8..5fec3d5ec 100644
--- a/busybox.c
+++ b/busybox.c
@@ -1,10 +1,10 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <stdio.h> 2#include <stdio.h>
4#include <string.h> 3#include <string.h>
5#include <unistd.h> 4#include <unistd.h>
6#include <errno.h> 5#include <errno.h>
7#include <stdlib.h> 6#include <stdlib.h>
7#include "busybox.h"
8 8
9#undef APPLET 9#undef APPLET
10#undef APPLET_NOUSAGE 10#undef APPLET_NOUSAGE
diff --git a/cat.c b/cat.c
index 134245cdc..3554008f8 100644
--- a/cat.c
+++ b/cat.c
@@ -21,8 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdlib.h> 24#include <stdlib.h>
25#include "busybox.h"
26 26
27extern int cat_main(int argc, char **argv) 27extern int cat_main(int argc, char **argv)
28{ 28{
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c
index 9363bd757..a458cf77a 100644
--- a/chmod_chown_chgrp.c
+++ b/chmod_chown_chgrp.c
@@ -22,16 +22,16 @@
22 * 22 *
23 */ 23 */
24 24
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28#include <unistd.h>
25#include "busybox.h" 29#include "busybox.h"
26#define BB_DECLARE_EXTERN 30#define BB_DECLARE_EXTERN
27#define bb_need_invalid_option 31#define bb_need_invalid_option
28#define bb_need_too_few_args 32#define bb_need_too_few_args
29#include "messages.c" 33#include "messages.c"
30 34
31#include <stdio.h>
32#include <stdlib.h>
33#include <string.h>
34#include <unistd.h>
35 35
36 36
37static long uid = -1; 37static long uid = -1;
diff --git a/chroot.c b/chroot.c
index e721e1ffa..bae9cd757 100644
--- a/chroot.c
+++ b/chroot.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdlib.h> 25#include <stdlib.h>
27#include <stdio.h> 26#include <stdio.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <errno.h> 28#include <errno.h>
29#include "busybox.h"
30 30
31int chroot_main(int argc, char **argv) 31int chroot_main(int argc, char **argv)
32{ 32{
diff --git a/chvt.c b/chvt.c
index f2e6d5f17..c4b3639df 100644
--- a/chvt.c
+++ b/chvt.c
@@ -4,12 +4,12 @@
4 * 4 *
5 * busyboxed by Erik Andersen 5 * busyboxed by Erik Andersen
6 */ 6 */
7#include "busybox.h"
8#include <stdio.h> 7#include <stdio.h>
9#include <stdlib.h> 8#include <stdlib.h>
10#include <fcntl.h> 9#include <fcntl.h>
11#include <sys/types.h> 10#include <sys/types.h>
12#include <sys/ioctl.h> 11#include <sys/ioctl.h>
12#include "busybox.h"
13 13
14/* From <linux/vt.h> */ 14/* From <linux/vt.h> */
15static const int VT_ACTIVATE = 0x5606; /* make vt active */ 15static const int VT_ACTIVATE = 0x5606; /* make vt active */
diff --git a/clear.c b/clear.c
index dab4b05a7..503bafa16 100644
--- a/clear.c
+++ b/clear.c
@@ -22,9 +22,9 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29 29
30extern int clear_main(int argc, char **argv) 30extern int clear_main(int argc, char **argv)
diff --git a/cmdedit.c b/cmdedit.c
index 97ba8316d..9cb53522f 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -32,6 +32,21 @@
32 32
33//#define TEST 33//#define TEST
34 34
35#include <stdio.h>
36#include <errno.h>
37#include <unistd.h>
38#include <stdlib.h>
39#include <string.h>
40#include <sys/ioctl.h>
41#include <ctype.h>
42#include <signal.h>
43#include <limits.h>
44
45#ifdef BB_FEATURE_SH_TAB_COMPLETION
46#include <dirent.h>
47#include <sys/stat.h>
48#endif
49
35 50
36#ifndef TEST 51#ifndef TEST
37 52
@@ -62,21 +77,6 @@
62#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR 77#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR
63#endif 78#endif
64 79
65#include <stdio.h>
66#include <errno.h>
67#include <unistd.h>
68#include <stdlib.h>
69#include <string.h>
70#include <sys/ioctl.h>
71#include <ctype.h>
72#include <signal.h>
73#include <limits.h>
74
75#ifdef BB_FEATURE_SH_TAB_COMPLETION
76#include <dirent.h>
77#include <sys/stat.h>
78#endif
79
80#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 80#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR
81#ifndef TEST 81#ifndef TEST
82#include "pwd_grp/pwd.h" 82#include "pwd_grp/pwd.h"
diff --git a/cmp.c b/cmp.c
index c04b6e1c9..24b6c3f92 100644
--- a/cmp.c
+++ b/cmp.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <string.h> 26#include <string.h>
28#include <errno.h> 27#include <errno.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31int cmp_main(int argc, char **argv) 31int cmp_main(int argc, char **argv)
32{ 32{
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
index f2e6d5f17..c4b3639df 100644
--- a/console-tools/chvt.c
+++ b/console-tools/chvt.c
@@ -4,12 +4,12 @@
4 * 4 *
5 * busyboxed by Erik Andersen 5 * busyboxed by Erik Andersen
6 */ 6 */
7#include "busybox.h"
8#include <stdio.h> 7#include <stdio.h>
9#include <stdlib.h> 8#include <stdlib.h>
10#include <fcntl.h> 9#include <fcntl.h>
11#include <sys/types.h> 10#include <sys/types.h>
12#include <sys/ioctl.h> 11#include <sys/ioctl.h>
12#include "busybox.h"
13 13
14/* From <linux/vt.h> */ 14/* From <linux/vt.h> */
15static const int VT_ACTIVATE = 0x5606; /* make vt active */ 15static const int VT_ACTIVATE = 0x5606; /* make vt active */
diff --git a/console-tools/clear.c b/console-tools/clear.c
index dab4b05a7..503bafa16 100644
--- a/console-tools/clear.c
+++ b/console-tools/clear.c
@@ -22,9 +22,9 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29 29
30extern int clear_main(int argc, char **argv) 30extern int clear_main(int argc, char **argv)
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index 8c390c261..15cd0c9b9 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -3,12 +3,12 @@
3 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s) 3 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
4 * Renamed deallocvt. 4 * Renamed deallocvt.
5 */ 5 */
6#include "busybox.h"
7#include <stdlib.h> 6#include <stdlib.h>
8#include <stdio.h> 7#include <stdio.h>
9#include <fcntl.h> 8#include <fcntl.h>
10#include <sys/types.h> 9#include <sys/types.h>
11#include <sys/ioctl.h> 10#include <sys/ioctl.h>
11#include "busybox.h"
12 12
13/* From <linux/vt.h> */ 13/* From <linux/vt.h> */
14static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */ 14static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c
index b9f1bd233..0da01868b 100644
--- a/console-tools/dumpkmap.c
+++ b/console-tools/dumpkmap.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <errno.h> 23#include <errno.h>
25#include <fcntl.h> 24#include <fcntl.h>
26#include <stdio.h> 25#include <stdio.h>
@@ -28,6 +27,7 @@
28#include <string.h> 27#include <string.h>
29#include <stdlib.h> 28#include <stdlib.h>
30#include <sys/ioctl.h> 29#include <sys/ioctl.h>
30#include "busybox.h"
31 31
32/* From <linux/kd.h> */ 32/* From <linux/kd.h> */
33struct kbentry { 33struct kbentry {
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c
index 6422137a1..81b973b02 100644
--- a/console-tools/loadacm.c
+++ b/console-tools/loadacm.c
@@ -7,7 +7,6 @@
7 * Peter Novodvorsky <petya@logic.ru> 7 * Peter Novodvorsky <petya@logic.ru>
8 */ 8 */
9 9
10#include "busybox.h"
11#include <stdio.h> 10#include <stdio.h>
12#include <stdlib.h> 11#include <stdlib.h>
13#include <memory.h> 12#include <memory.h>
@@ -17,9 +16,10 @@
17#include <assert.h> 16#include <assert.h>
18#include <errno.h> 17#include <errno.h>
19#include <signal.h> 18#include <signal.h>
19#include <sys/kd.h>
20#include <sys/types.h> 20#include <sys/types.h>
21#include <sys/ioctl.h> 21#include <sys/ioctl.h>
22#include <sys/kd.h> 22#include "busybox.h"
23 23
24typedef unsigned short unicode; 24typedef unsigned short unicode;
25 25
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index d7bd7e8f5..1a724ca85 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -7,7 +7,6 @@
7 * Loads the console font, and possibly the corresponding screen map(s). 7 * Loads the console font, and possibly the corresponding screen map(s).
8 * (Adapted for busybox by Matej Vela.) 8 * (Adapted for busybox by Matej Vela.)
9 */ 9 */
10#include "busybox.h"
11#include <stdio.h> 10#include <stdio.h>
12#include <string.h> 11#include <string.h>
13#include <fcntl.h> 12#include <fcntl.h>
@@ -20,6 +19,7 @@
20#include <sys/ioctl.h> 19#include <sys/ioctl.h>
21#include <sys/kd.h> 20#include <sys/kd.h>
22#include <endian.h> 21#include <endian.h>
22#include "busybox.h"
23 23
24static const int PSF_MAGIC1 = 0x36; 24static const int PSF_MAGIC1 = 0x36;
25static const int PSF_MAGIC2 = 0x04; 25static const int PSF_MAGIC2 = 0x04;
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index 5ecd819f9..dcb5c1caa 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <errno.h> 23#include <errno.h>
25#include <fcntl.h> 24#include <fcntl.h>
26#include <stdio.h> 25#include <stdio.h>
@@ -28,6 +27,7 @@
28#include <stdlib.h> 27#include <stdlib.h>
29#include <unistd.h> 28#include <unistd.h>
30#include <sys/ioctl.h> 29#include <sys/ioctl.h>
30#include "busybox.h"
31 31
32#define BINARY_KEYMAP_MAGIC "bkeymap" 32#define BINARY_KEYMAP_MAGIC "bkeymap"
33 33
diff --git a/console-tools/reset.c b/console-tools/reset.c
index 294cab3c4..755c4c335 100644
--- a/console-tools/reset.c
+++ b/console-tools/reset.c
@@ -23,9 +23,9 @@
23 * 23 *
24 */ 24 */
25 25
26#include "busybox.h"
27#include <stdio.h> 26#include <stdio.h>
28#include <stdlib.h> 27#include <stdlib.h>
28#include "busybox.h"
29 29
30extern int reset_main(int argc, char **argv) 30extern int reset_main(int argc, char **argv)
31{ 31{
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c
index 0be4724ca..c3c7e09aa 100644
--- a/console-tools/setkeycodes.c
+++ b/console-tools/setkeycodes.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
28#include <fcntl.h> 27#include <fcntl.h>
29#include <sys/ioctl.h> 28#include <sys/ioctl.h>
29#include "busybox.h"
30 30
31 31
32/* From <linux/kd.h> */ 32/* From <linux/kd.h> */
diff --git a/coreutils/basename.c b/coreutils/basename.c
index da59a8672..da0b7ecc3 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -21,8 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdlib.h> 24#include <stdlib.h>
25#include "busybox.h"
26#include <string.h> 26#include <string.h>
27 27
28extern int basename_main(int argc, char **argv) 28extern int basename_main(int argc, char **argv)
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 134245cdc..3554008f8 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -21,8 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdlib.h> 24#include <stdlib.h>
25#include "busybox.h"
26 26
27extern int cat_main(int argc, char **argv) 27extern int cat_main(int argc, char **argv)
28{ 28{
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index e721e1ffa..bae9cd757 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdlib.h> 25#include <stdlib.h>
27#include <stdio.h> 26#include <stdio.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <errno.h> 28#include <errno.h>
29#include "busybox.h"
30 30
31int chroot_main(int argc, char **argv) 31int chroot_main(int argc, char **argv)
32{ 32{
diff --git a/coreutils/cmp.c b/coreutils/cmp.c
index c04b6e1c9..24b6c3f92 100644
--- a/coreutils/cmp.c
+++ b/coreutils/cmp.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <string.h> 26#include <string.h>
28#include <errno.h> 27#include <errno.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31int cmp_main(int argc, char **argv) 31int cmp_main(int argc, char **argv)
32{ 32{
diff --git a/coreutils/date.c b/coreutils/date.c
index 21d31bb25..878331f71 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -20,11 +20,6 @@
20 * 20 *
21*/ 21*/
22 22
23#include "busybox.h"
24#define BB_DECLARE_EXTERN
25#define bb_need_invalid_date
26#define bb_need_memory_exhausted
27#include "messages.c"
28#include <stdlib.h> 23#include <stdlib.h>
29#include <errno.h> 24#include <errno.h>
30#include <sys/time.h> 25#include <sys/time.h>
@@ -33,6 +28,11 @@
33#include <stdio.h> 28#include <stdio.h>
34#include <string.h> 29#include <string.h>
35#include <getopt.h> 30#include <getopt.h>
31#include "busybox.h"
32#define BB_DECLARE_EXTERN
33#define bb_need_invalid_date
34#define bb_need_memory_exhausted
35#include "messages.c"
36 36
37 37
38/* This 'date' command supports only 2 time setting formats, 38/* This 'date' command supports only 2 time setting formats,
diff --git a/coreutils/dd.c b/coreutils/dd.c
index e445e0435..1618dd102 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -21,14 +21,14 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25
26#include <sys/types.h> 24#include <sys/types.h>
27#include <stdlib.h> 25#include <stdlib.h>
28#include <stdio.h> 26#include <stdio.h>
29#include <unistd.h> 27#include <unistd.h>
30#include <string.h> 28#include <string.h>
31#include <fcntl.h> 29#include <fcntl.h>
30#include "busybox.h"
31
32 32
33static const struct suffix_mult dd_suffixes[] = { 33static const struct suffix_mult dd_suffixes[] = {
34 { "c", 1 }, 34 { "c", 1 },
diff --git a/coreutils/df.c b/coreutils/df.c
index 692205a0e..ebee4d607 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -22,12 +22,12 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
28#include <mntent.h> 27#include <mntent.h>
29#include <sys/vfs.h> 28#include <sys/vfs.h>
30#include <getopt.h> 29#include <getopt.h>
30#include "busybox.h"
31 31
32extern const char mtab_file[]; /* Defined in utility.c */ 32extern const char mtab_file[]; /* Defined in utility.c */
33#ifdef BB_FEATURE_HUMAN_READABLE 33#ifdef BB_FEATURE_HUMAN_READABLE
diff --git a/coreutils/dirname.c b/coreutils/dirname.c
index e34ecf8a9..7f191c1b9 100644
--- a/coreutils/dirname.c
+++ b/coreutils/dirname.c
@@ -20,10 +20,11 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * 21 *
22 */ 22 */
23#include "busybox.h" 23
24#include <stdio.h> 24#include <stdio.h>
25#include <stdlib.h> 25#include <stdlib.h>
26#include <string.h> 26#include <string.h>
27#include "busybox.h"
27 28
28extern int dirname_main(int argc, char **argv) 29extern int dirname_main(int argc, char **argv)
29{ 30{
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index 32423611c..222c8f6a4 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -22,9 +22,9 @@
22 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/ 23*/
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29int dos2unix_main( int argc, char **argv ) { 29int dos2unix_main( int argc, char **argv ) {
30 int c; 30 int c;
diff --git a/coreutils/du.c b/coreutils/du.c
index 516f4c92b..6197b0bc1 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -22,11 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#define BB_DECLARE_EXTERN
27#define bb_need_name_too_long
28#include "messages.c"
29
30#include <sys/types.h> 25#include <sys/types.h>
31#include <fcntl.h> 26#include <fcntl.h>
32#include <dirent.h> 27#include <dirent.h>
@@ -34,6 +29,11 @@
34#include <stdlib.h> 29#include <stdlib.h>
35#include <getopt.h> 30#include <getopt.h>
36#include <errno.h> 31#include <errno.h>
32#include "busybox.h"
33#define BB_DECLARE_EXTERN
34#define bb_need_name_too_long
35#include "messages.c"
36
37 37
38#ifdef BB_FEATURE_HUMAN_READABLE 38#ifdef BB_FEATURE_HUMAN_READABLE
39unsigned long du_disp_hr = KILOBYTE; 39unsigned long du_disp_hr = KILOBYTE;
@@ -187,7 +187,7 @@ int du_main(int argc, char **argv)
187 return status; 187 return status;
188} 188}
189 189
190/* $Id: du.c,v 1.37 2001/02/14 21:23:05 andersen Exp $ */ 190/* $Id: du.c,v 1.38 2001/02/20 06:14:07 andersen Exp $ */
191/* 191/*
192Local Variables: 192Local Variables:
193c-file-style: "linux" 193c-file-style: "linux"
diff --git a/coreutils/echo.c b/coreutils/echo.c
index b3e01afec..e9bc50a15 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -22,10 +22,10 @@
22 * Original copyright notice is retained at the end of this file. 22 * Original copyright notice is retained at the end of this file.
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <string.h> 26#include <string.h>
28#include <stdlib.h> 27#include <stdlib.h>
28#include "busybox.h"
29 29
30extern int 30extern int
31echo_main(int argc, char** argv) 31echo_main(int argc, char** argv)
diff --git a/coreutils/expr.c b/coreutils/expr.c
index 8ef5293c1..3b454bd3a 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -33,12 +33,12 @@
33 * One function can handle multiple operators all of equal precedence, 33 * One function can handle multiple operators all of equal precedence,
34 * provided they all associate ((x op x) op x). */ 34 * provided they all associate ((x op x) op x). */
35 35
36#include "busybox.h"
37#include <stdio.h> 36#include <stdio.h>
38#include <string.h> 37#include <string.h>
39#include <stdlib.h> 38#include <stdlib.h>
40#include <regex.h> 39#include <regex.h>
41#include <sys/types.h> 40#include <sys/types.h>
41#include "busybox.h"
42 42
43 43
44/* The kinds of value we can have. */ 44/* The kinds of value we can have. */
diff --git a/coreutils/head.c b/coreutils/head.c
index a2d774437..c683ec78a 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <errno.h> 25#include <errno.h>
27#include <stdio.h> 26#include <stdio.h>
28#include <getopt.h> 27#include <getopt.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31int head(int len, FILE *fp) 31int head(int len, FILE *fp)
32{ 32{
diff --git a/coreutils/hostid.c b/coreutils/hostid.c
index eed1a50ec..68a2cc659 100644
--- a/coreutils/hostid.c
+++ b/coreutils/hostid.c
@@ -20,10 +20,10 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
26#include "busybox.h"
27 27
28extern int hostid_main(int argc, char **argv) 28extern int hostid_main(int argc, char **argv)
29{ 29{
diff --git a/coreutils/length.c b/coreutils/length.c
index 9119adca8..73becd28a 100644
--- a/coreutils/length.c
+++ b/coreutils/length.c
@@ -1,8 +1,8 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <stdlib.h> 2#include <stdlib.h>
4#include <string.h> 3#include <string.h>
5#include <stdio.h> 4#include <stdio.h>
5#include "busybox.h"
6 6
7extern int length_main(int argc, char **argv) 7extern int length_main(int argc, char **argv)
8{ 8{
diff --git a/coreutils/ln.c b/coreutils/ln.c
index e35bf7a03..6d41cce62 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -21,17 +21,17 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#define BB_DECLARE_EXTERN
26#define bb_need_not_a_directory
27#include "messages.c"
28
29#include <stdio.h> 24#include <stdio.h>
30#include <dirent.h> 25#include <dirent.h>
31#include <string.h> 26#include <string.h>
32#include <stdlib.h> 27#include <stdlib.h>
33#include <errno.h> 28#include <errno.h>
34#include <unistd.h> 29#include <unistd.h>
30#include "busybox.h"
31#define BB_DECLARE_EXTERN
32#define bb_need_not_a_directory
33#include "messages.c"
34
35 35
36static const int LN_SYMLINK = 1; 36static const int LN_SYMLINK = 1;
37static const int LN_FORCE = 2; 37static const int LN_FORCE = 2;
diff --git a/coreutils/logname.c b/coreutils/logname.c
index a1887aaf9..0924b2471 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -20,10 +20,10 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
26#include "busybox.h"
27 27
28extern int logname_main(int argc, char **argv) 28extern int logname_main(int argc, char **argv)
29{ 29{
diff --git a/coreutils/ls.c b/coreutils/ls.c
index dd38dd5f3..a619bb8b2 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -50,7 +50,6 @@ enum {
50 50
51/************************************************************************/ 51/************************************************************************/
52 52
53#include "busybox.h"
54#include <sys/types.h> 53#include <sys/types.h>
55#include <sys/stat.h> 54#include <sys/stat.h>
56#include <stdio.h> 55#include <stdio.h>
@@ -67,6 +66,7 @@ enum {
67#include <fcntl.h> 66#include <fcntl.h>
68#include <signal.h> 67#include <signal.h>
69#include <sys/ioctl.h> 68#include <sys/ioctl.h>
69#include "busybox.h"
70 70
71#ifndef MAJOR 71#ifndef MAJOR
72#define MAJOR(dev) (((dev)>>8)&0xff) 72#define MAJOR(dev) (((dev)>>8)&0xff)
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c
index 3decafdf4..fa11ee61d 100644
--- a/coreutils/md5sum.c
+++ b/coreutils/md5sum.c
@@ -20,11 +20,11 @@
20/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu> */ 20/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu> */
21/* Hacked to work with BusyBox by Alfred M. Szmidt <ams@trillian.itslinux.org> */ 21/* Hacked to work with BusyBox by Alfred M. Szmidt <ams@trillian.itslinux.org> */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <errno.h> 24#include <errno.h>
26#include <ctype.h> 25#include <ctype.h>
27#include <getopt.h> 26#include <getopt.h>
27#include "busybox.h"
28 28
29/* For some silly reason, this file uses backwards TRUE and FALSE conventions */ 29/* For some silly reason, this file uses backwards TRUE and FALSE conventions */
30#undef TRUE 30#undef TRUE
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 285d34f12..902da7c99 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -21,15 +21,15 @@
21 * 21 *
22 */ 22 */
23 23
24#include <stdio.h>
25#include <errno.h>
26#include <string.h>
27#include <stdlib.h>
24#include "busybox.h" 28#include "busybox.h"
25#define bb_need_name_too_long 29#define bb_need_name_too_long
26#define BB_DECLARE_EXTERN 30#define BB_DECLARE_EXTERN
27#include "messages.c" 31#include "messages.c"
28 32
29#include <stdio.h>
30#include <errno.h>
31#include <string.h>
32#include <stdlib.h>
33 33
34static int parentFlag = FALSE; 34static int parentFlag = FALSE;
35static mode_t mode = 0777; 35static mode_t mode = 0777;
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c
index 56a04f772..ca217fa23 100644
--- a/coreutils/mkfifo.c
+++ b/coreutils/mkfifo.c
@@ -20,11 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <sys/types.h> 24#include <sys/types.h>
26#include <errno.h> 25#include <errno.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int mkfifo_main(int argc, char **argv) 29extern int mkfifo_main(int argc, char **argv)
30{ 30{
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index 73f6e06f1..b4d4b82a1 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -20,14 +20,14 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <errno.h> 24#include <errno.h>
26#include <sys/types.h>
27#include <fcntl.h> 25#include <fcntl.h>
28#include <unistd.h> 26#include <unistd.h>
29#include <string.h> 27#include <string.h>
30#include <stdlib.h> 28#include <stdlib.h>
29#include <sys/types.h>
30#include "busybox.h"
31 31
32int mknod_main(int argc, char **argv) 32int mknod_main(int argc, char **argv)
33{ 33{
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 26a200e85..003423d56 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -47,7 +47,6 @@
47 47
48// 19990508 Busy Boxed! Dave Cinege 48// 19990508 Busy Boxed! Dave Cinege
49 49
50#include "busybox.h"
51#include <unistd.h> 50#include <unistd.h>
52#include <stdio.h> 51#include <stdio.h>
53#include <sys/types.h> 52#include <sys/types.h>
@@ -56,6 +55,7 @@
56#include <stdlib.h> 55#include <stdlib.h>
57#include <fcntl.h> 56#include <fcntl.h>
58#include <ctype.h> 57#include <ctype.h>
58#include "busybox.h"
59 59
60 60
61#ifndef S_IFMT 61#ifndef S_IFMT
diff --git a/coreutils/pwd.c b/coreutils/pwd.c
index a9acbc721..a7a5f78a1 100644
--- a/coreutils/pwd.c
+++ b/coreutils/pwd.c
@@ -21,12 +21,12 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <dirent.h> 25#include <dirent.h>
27#include <errno.h> 26#include <errno.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31extern int pwd_main(int argc, char **argv) 31extern int pwd_main(int argc, char **argv)
32{ 32{
diff --git a/coreutils/rm.c b/coreutils/rm.c
index 566076707..a84163272 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <time.h> 26#include <time.h>
28#include <utime.h> 27#include <utime.h>
@@ -30,6 +29,7 @@
30#include <errno.h> 29#include <errno.h>
31#include <unistd.h> 30#include <unistd.h>
32#include <stdlib.h> 31#include <stdlib.h>
32#include "busybox.h"
33 33
34static int recursiveFlag = FALSE; 34static int recursiveFlag = FALSE;
35static int forceFlag = FALSE; 35static int forceFlag = FALSE;
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index 6266ce1ef..2c280376f 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <errno.h> 26#include <errno.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31extern int rmdir_main(int argc, char **argv) 31extern int rmdir_main(int argc, char **argv)
32{ 32{
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index d21af19b3..3bcab88ee 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <unistd.h> 25#include <unistd.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int sleep_main(int argc, char **argv) 29extern int sleep_main(int argc, char **argv)
30{ 30{
diff --git a/coreutils/sort.c b/coreutils/sort.c
index 4984f5dfe..ed6872218 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -21,9 +21,9 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <getopt.h> 24#include <getopt.h>
26#include <stdlib.h> 25#include <stdlib.h>
26#include "busybox.h"
27 27
28int compare_ascii(const void *x, const void *y) 28int compare_ascii(const void *x, const void *y)
29{ 29{
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 4a5aecf1d..10e28254d 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -28,7 +28,6 @@
28 28
29 */ 29 */
30 30
31#include "busybox.h"
32 31
33#include <termios.h> 32#include <termios.h>
34#include <sys/ioctl.h> 33#include <sys/ioctl.h>
@@ -53,6 +52,7 @@
53#include <limits.h> 52#include <limits.h>
54#include <memory.h> 53#include <memory.h>
55#include <fcntl.h> 54#include <fcntl.h>
55#include "busybox.h"
56 56
57#define STREQ(a, b) (strcmp ((a), (b)) == 0) 57#define STREQ(a, b) (strcmp ((a), (b)) == 0)
58 58
diff --git a/coreutils/sync.c b/coreutils/sync.c
index 3d4686efa..ee22ae109 100644
--- a/coreutils/sync.c
+++ b/coreutils/sync.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <unistd.h> 26#include <unistd.h>
27#include "busybox.h"
28 28
29extern int sync_main(int argc, char **argv) 29extern int sync_main(int argc, char **argv)
30{ 30{
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 778c2d18b..a85256c80 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25 24
26#include <fcntl.h> 25#include <fcntl.h>
27#include <getopt.h> 26#include <getopt.h>
@@ -29,6 +28,7 @@
29#include <stdlib.h> 28#include <stdlib.h>
30#include <unistd.h> 29#include <unistd.h>
31#include <sys/types.h> 30#include <sys/types.h>
31#include "busybox.h"
32 32
33static const struct suffix_mult tail_suffixes[] = { 33static const struct suffix_mult tail_suffixes[] = {
34 { "b", 512 }, 34 { "b", 512 },
diff --git a/coreutils/test.c b/coreutils/test.c
index 6439e3a8a..ab9c23e4b 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -31,13 +31,13 @@
31 * "This program is in the Public Domain." 31 * "This program is in the Public Domain."
32 */ 32 */
33 33
34#include "busybox.h"
35#include <sys/types.h> 34#include <sys/types.h>
36#include <unistd.h> 35#include <unistd.h>
37#include <ctype.h> 36#include <ctype.h>
38#include <errno.h> 37#include <errno.h>
39#include <stdlib.h> 38#include <stdlib.h>
40#include <string.h> 39#include <string.h>
40#include "busybox.h"
41#define BB_DECLARE_EXTERN 41#define BB_DECLARE_EXTERN
42#define bb_need_help 42#define bb_need_help
43#include "messages.c" 43#include "messages.c"
diff --git a/coreutils/touch.c b/coreutils/touch.c
index a3256d559..1718da71e 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <sys/types.h> 26#include <sys/types.h>
28#include <fcntl.h> 27#include <fcntl.h>
@@ -30,6 +29,7 @@
30#include <errno.h> 29#include <errno.h>
31#include <unistd.h> 30#include <unistd.h>
32#include <stdlib.h> 31#include <stdlib.h>
32#include "busybox.h"
33 33
34extern int touch_main(int argc, char **argv) 34extern int touch_main(int argc, char **argv)
35{ 35{
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 92f399e14..b7a6009c8 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -24,12 +24,12 @@
24 * Original copyright notice is retained at the end of this file. 24 * Original copyright notice is retained at the end of this file.
25 */ 25 */
26 26
27#include "busybox.h"
28#include <stdio.h> 27#include <stdio.h>
29#include <string.h> 28#include <string.h>
30#include <stdlib.h> 29#include <stdlib.h>
31#include <unistd.h> 30#include <unistd.h>
32#include <sys/types.h> 31#include <sys/types.h>
32#include "busybox.h"
33#define BB_DECLARE_EXTERN 33#define BB_DECLARE_EXTERN
34#define bb_need_write_error 34#define bb_need_write_error
35#include "messages.c" 35#include "messages.c"
diff --git a/coreutils/tty.c b/coreutils/tty.c
index d71d8dedb..4510c2996 100644
--- a/coreutils/tty.c
+++ b/coreutils/tty.c
@@ -20,11 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
27#include <sys/types.h> 26#include <sys/types.h>
27#include "busybox.h"
28 28
29extern int tty_main(int argc, char **argv) 29extern int tty_main(int argc, char **argv)
30{ 30{
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 899da7792..4931ff1d8 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -31,7 +31,6 @@
31 31
32/* Busyboxed by Erik Andersen */ 32/* Busyboxed by Erik Andersen */
33 33
34#include "busybox.h"
35#include <stdio.h> 34#include <stdio.h>
36#include <stdlib.h> 35#include <stdlib.h>
37#include <sys/types.h> 36#include <sys/types.h>
@@ -40,6 +39,7 @@
40#if defined (HAVE_SYSINFO) && defined (HAVE_SYS_SYSTEMINFO_H) 39#if defined (HAVE_SYSINFO) && defined (HAVE_SYS_SYSTEMINFO_H)
41# include <sys/systeminfo.h> 40# include <sys/systeminfo.h>
42#endif 41#endif
42#include "busybox.h"
43 43
44static void print_element(unsigned int mask, char *element); 44static void print_element(unsigned int mask, char *element);
45 45
diff --git a/coreutils/uniq.c b/coreutils/uniq.c
index 84f1ed231..53e3c64f2 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -23,12 +23,12 @@
23 * 23 *
24 */ 24 */
25 25
26#include "busybox.h"
27#include <stdio.h> 26#include <stdio.h>
28#include <string.h> 27#include <string.h>
29#include <getopt.h> 28#include <getopt.h>
30#include <errno.h> 29#include <errno.h>
31#include <stdlib.h> 30#include <stdlib.h>
31#include "busybox.h"
32 32
33static int print_count; 33static int print_count;
34static int print_uniq = 1; 34static int print_uniq = 1;
diff --git a/coreutils/usleep.c b/coreutils/usleep.c
index c67c365b8..92e4437c5 100644
--- a/coreutils/usleep.c
+++ b/coreutils/usleep.c
@@ -21,9 +21,9 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
26#include "busybox.h"
27 27
28extern int usleep_main(int argc, char **argv) 28extern int usleep_main(int argc, char **argv)
29{ 29{
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index c0e8cea8c..6a3f78a42 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -22,13 +22,13 @@
22 */ 22 */
23 23
24 24
25#include "busybox.h"
26 25
27#include <stdio.h> 26#include <stdio.h>
28#include <errno.h> 27#include <errno.h>
29#include <getopt.h> 28#include <getopt.h>
30#include <string.h> 29#include <string.h>
31#include <stdlib.h> 30#include <stdlib.h>
31#include "busybox.h"
32#include "pwd_grp/pwd.h" 32#include "pwd_grp/pwd.h"
33#include "pwd_grp/grp.h" 33#include "pwd_grp/grp.h"
34 34
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index 8d5af4a8a..41541defb 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -22,12 +22,12 @@
22/* Hacked to work with BusyBox by Alfred M. Szmidt */ 22/* Hacked to work with BusyBox by Alfred M. Szmidt */
23 23
24 24
25#include "busybox.h"
26 25
27#include <stdio.h> 26#include <stdio.h>
28#include <errno.h> 27#include <errno.h>
29#include <getopt.h> 28#include <getopt.h>
30#include <stdlib.h> 29#include <stdlib.h>
30#include "busybox.h"
31 31
32#define RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) 32#define RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
33 33
diff --git a/coreutils/wc.c b/coreutils/wc.c
index f41687422..f2d33d6f3 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -20,10 +20,10 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <getopt.h> 24#include <getopt.h>
26#include <stdlib.h> 25#include <stdlib.h>
26#include "busybox.h"
27 27
28static int total_lines, total_words, total_chars, max_length; 28static int total_lines, total_words, total_chars, max_length;
29static int print_lines, print_words, print_chars, print_length; 29static int print_lines, print_words, print_chars, print_length;
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 54df0bf12..0bbb54b7b 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -20,10 +20,10 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
26#include "busybox.h"
27 27
28extern int whoami_main(int argc, char **argv) 28extern int whoami_main(int argc, char **argv)
29{ 29{
diff --git a/coreutils/yes.c b/coreutils/yes.c
index 0a8ad83a7..ad7b98f84 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -20,9 +20,9 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
25#include "busybox.h"
26 26
27extern int yes_main(int argc, char **argv) 27extern int yes_main(int argc, char **argv)
28{ 28{
diff --git a/cp_mv.c b/cp_mv.c
index 8052b41a6..fb48d3c5c 100644
--- a/cp_mv.c
+++ b/cp_mv.c
@@ -25,13 +25,6 @@
25 * 25 *
26 */ 26 */
27 27
28#include "busybox.h"
29#define BB_DECLARE_EXTERN
30#define bb_need_name_too_long
31#define bb_need_omitting_directory
32#define bb_need_not_a_directory
33#include "messages.c"
34
35#include <stdio.h> 28#include <stdio.h>
36#include <time.h> 29#include <time.h>
37#include <utime.h> 30#include <utime.h>
@@ -43,6 +36,13 @@
43#include <errno.h> 36#include <errno.h>
44#include <getopt.h> 37#include <getopt.h>
45#include <stdlib.h> 38#include <stdlib.h>
39#include "busybox.h"
40#define BB_DECLARE_EXTERN
41#define bb_need_name_too_long
42#define bb_need_omitting_directory
43#define bb_need_not_a_directory
44#include "messages.c"
45
46 46
47static const int is_cp = 0; 47static const int is_cp = 0;
48static const int is_mv = 1; 48static const int is_mv = 1;
diff --git a/date.c b/date.c
index 21d31bb25..878331f71 100644
--- a/date.c
+++ b/date.c
@@ -20,11 +20,6 @@
20 * 20 *
21*/ 21*/
22 22
23#include "busybox.h"
24#define BB_DECLARE_EXTERN
25#define bb_need_invalid_date
26#define bb_need_memory_exhausted
27#include "messages.c"
28#include <stdlib.h> 23#include <stdlib.h>
29#include <errno.h> 24#include <errno.h>
30#include <sys/time.h> 25#include <sys/time.h>
@@ -33,6 +28,11 @@
33#include <stdio.h> 28#include <stdio.h>
34#include <string.h> 29#include <string.h>
35#include <getopt.h> 30#include <getopt.h>
31#include "busybox.h"
32#define BB_DECLARE_EXTERN
33#define bb_need_invalid_date
34#define bb_need_memory_exhausted
35#include "messages.c"
36 36
37 37
38/* This 'date' command supports only 2 time setting formats, 38/* This 'date' command supports only 2 time setting formats,
diff --git a/dc.c b/dc.c
index 1e34574ed..a422139b1 100644
--- a/dc.c
+++ b/dc.c
@@ -1,10 +1,10 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <ctype.h> 2#include <ctype.h>
4#include <stdio.h> 3#include <stdio.h>
5#include <stdlib.h> 4#include <stdlib.h>
6#include <unistd.h> 5#include <unistd.h>
7#include <math.h> 6#include <math.h>
7#include "busybox.h"
8 8
9/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */ 9/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */
10 10
diff --git a/dd.c b/dd.c
index e445e0435..1618dd102 100644
--- a/dd.c
+++ b/dd.c
@@ -21,14 +21,14 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25
26#include <sys/types.h> 24#include <sys/types.h>
27#include <stdlib.h> 25#include <stdlib.h>
28#include <stdio.h> 26#include <stdio.h>
29#include <unistd.h> 27#include <unistd.h>
30#include <string.h> 28#include <string.h>
31#include <fcntl.h> 29#include <fcntl.h>
30#include "busybox.h"
31
32 32
33static const struct suffix_mult dd_suffixes[] = { 33static const struct suffix_mult dd_suffixes[] = {
34 { "c", 1 }, 34 { "c", 1 },
diff --git a/deallocvt.c b/deallocvt.c
index 8c390c261..15cd0c9b9 100644
--- a/deallocvt.c
+++ b/deallocvt.c
@@ -3,12 +3,12 @@
3 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s) 3 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
4 * Renamed deallocvt. 4 * Renamed deallocvt.
5 */ 5 */
6#include "busybox.h"
7#include <stdlib.h> 6#include <stdlib.h>
8#include <stdio.h> 7#include <stdio.h>
9#include <fcntl.h> 8#include <fcntl.h>
10#include <sys/types.h> 9#include <sys/types.h>
11#include <sys/ioctl.h> 10#include <sys/ioctl.h>
11#include "busybox.h"
12 12
13/* From <linux/vt.h> */ 13/* From <linux/vt.h> */
14static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */ 14static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
diff --git a/df.c b/df.c
index 692205a0e..ebee4d607 100644
--- a/df.c
+++ b/df.c
@@ -22,12 +22,12 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
28#include <mntent.h> 27#include <mntent.h>
29#include <sys/vfs.h> 28#include <sys/vfs.h>
30#include <getopt.h> 29#include <getopt.h>
30#include "busybox.h"
31 31
32extern const char mtab_file[]; /* Defined in utility.c */ 32extern const char mtab_file[]; /* Defined in utility.c */
33#ifdef BB_FEATURE_HUMAN_READABLE 33#ifdef BB_FEATURE_HUMAN_READABLE
diff --git a/dirname.c b/dirname.c
index e34ecf8a9..7f191c1b9 100644
--- a/dirname.c
+++ b/dirname.c
@@ -20,10 +20,11 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * 21 *
22 */ 22 */
23#include "busybox.h" 23
24#include <stdio.h> 24#include <stdio.h>
25#include <stdlib.h> 25#include <stdlib.h>
26#include <string.h> 26#include <string.h>
27#include "busybox.h"
27 28
28extern int dirname_main(int argc, char **argv) 29extern int dirname_main(int argc, char **argv)
29{ 30{
diff --git a/dmesg.c b/dmesg.c
index 47f9f4474..2c85ed3e9 100644
--- a/dmesg.c
+++ b/dmesg.c
@@ -15,7 +15,6 @@
15 * Support, replaced getopt, added some gotos for redundant stuff. 15 * Support, replaced getopt, added some gotos for redundant stuff.
16 */ 16 */
17 17
18#include "busybox.h"
19#include <stdio.h> 18#include <stdio.h>
20#include <stdlib.h> 19#include <stdlib.h>
21#include <getopt.h> 20#include <getopt.h>
@@ -33,6 +32,7 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
33#else 32#else
34# include <sys/klog.h> 33# include <sys/klog.h>
35#endif 34#endif
35#include "busybox.h"
36 36
37int dmesg_main(int argc, char **argv) 37int dmesg_main(int argc, char **argv)
38{ 38{
diff --git a/dos2unix.c b/dos2unix.c
index 32423611c..222c8f6a4 100644
--- a/dos2unix.c
+++ b/dos2unix.c
@@ -22,9 +22,9 @@
22 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/ 23*/
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29int dos2unix_main( int argc, char **argv ) { 29int dos2unix_main( int argc, char **argv ) {
30 int c; 30 int c;
diff --git a/du.c b/du.c
index 516f4c92b..6197b0bc1 100644
--- a/du.c
+++ b/du.c
@@ -22,11 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#define BB_DECLARE_EXTERN
27#define bb_need_name_too_long
28#include "messages.c"
29
30#include <sys/types.h> 25#include <sys/types.h>
31#include <fcntl.h> 26#include <fcntl.h>
32#include <dirent.h> 27#include <dirent.h>
@@ -34,6 +29,11 @@
34#include <stdlib.h> 29#include <stdlib.h>
35#include <getopt.h> 30#include <getopt.h>
36#include <errno.h> 31#include <errno.h>
32#include "busybox.h"
33#define BB_DECLARE_EXTERN
34#define bb_need_name_too_long
35#include "messages.c"
36
37 37
38#ifdef BB_FEATURE_HUMAN_READABLE 38#ifdef BB_FEATURE_HUMAN_READABLE
39unsigned long du_disp_hr = KILOBYTE; 39unsigned long du_disp_hr = KILOBYTE;
@@ -187,7 +187,7 @@ int du_main(int argc, char **argv)
187 return status; 187 return status;
188} 188}
189 189
190/* $Id: du.c,v 1.37 2001/02/14 21:23:05 andersen Exp $ */ 190/* $Id: du.c,v 1.38 2001/02/20 06:14:07 andersen Exp $ */
191/* 191/*
192Local Variables: 192Local Variables:
193c-file-style: "linux" 193c-file-style: "linux"
diff --git a/dumpkmap.c b/dumpkmap.c
index b9f1bd233..0da01868b 100644
--- a/dumpkmap.c
+++ b/dumpkmap.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <errno.h> 23#include <errno.h>
25#include <fcntl.h> 24#include <fcntl.h>
26#include <stdio.h> 25#include <stdio.h>
@@ -28,6 +27,7 @@
28#include <string.h> 27#include <string.h>
29#include <stdlib.h> 28#include <stdlib.h>
30#include <sys/ioctl.h> 29#include <sys/ioctl.h>
30#include "busybox.h"
31 31
32/* From <linux/kd.h> */ 32/* From <linux/kd.h> */
33struct kbentry { 33struct kbentry {
diff --git a/dutmp.c b/dutmp.c
index 2e6b3c056..a75a6e392 100644
--- a/dutmp.c
+++ b/dutmp.c
@@ -12,17 +12,17 @@
12 * Erik Andersen <andersen@lineo.com> 12 * Erik Andersen <andersen@lineo.com>
13 */ 13 */
14 14
15#include "busybox.h"
16#include <sys/types.h> 15#include <sys/types.h>
17#include <fcntl.h> 16#include <fcntl.h>
18 17
19#include <errno.h> 18#include <errno.h>
20#define BB_DECLARE_EXTERN
21#define bb_need_io_error
22#include "messages.c"
23#include <utmp.h> 19#include <utmp.h>
24#include <stdlib.h> 20#include <stdlib.h>
25#include <unistd.h> 21#include <unistd.h>
22#include "busybox.h"
23#define BB_DECLARE_EXTERN
24#define bb_need_io_error
25#include "messages.c"
26 26
27extern int dutmp_main(int argc, char **argv) 27extern int dutmp_main(int argc, char **argv)
28{ 28{
diff --git a/echo.c b/echo.c
index b3e01afec..e9bc50a15 100644
--- a/echo.c
+++ b/echo.c
@@ -22,10 +22,10 @@
22 * Original copyright notice is retained at the end of this file. 22 * Original copyright notice is retained at the end of this file.
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <string.h> 26#include <string.h>
28#include <stdlib.h> 27#include <stdlib.h>
28#include "busybox.h"
29 29
30extern int 30extern int
31echo_main(int argc, char** argv) 31echo_main(int argc, char** argv)
diff --git a/expr.c b/expr.c
index 8ef5293c1..3b454bd3a 100644
--- a/expr.c
+++ b/expr.c
@@ -33,12 +33,12 @@
33 * One function can handle multiple operators all of equal precedence, 33 * One function can handle multiple operators all of equal precedence,
34 * provided they all associate ((x op x) op x). */ 34 * provided they all associate ((x op x) op x). */
35 35
36#include "busybox.h"
37#include <stdio.h> 36#include <stdio.h>
38#include <string.h> 37#include <string.h>
39#include <stdlib.h> 38#include <stdlib.h>
40#include <regex.h> 39#include <regex.h>
41#include <sys/types.h> 40#include <sys/types.h>
41#include "busybox.h"
42 42
43 43
44/* The kinds of value we can have. */ 44/* The kinds of value we can have. */
diff --git a/fbset.c b/fbset.c
index 9acabbecb..72284a6c5 100644
--- a/fbset.c
+++ b/fbset.c
@@ -24,7 +24,6 @@
24 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) 24 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
25 */ 25 */
26 26
27#include "busybox.h"
28#include <stdio.h> 27#include <stdio.h>
29#include <stdlib.h> 28#include <stdlib.h>
30#include <unistd.h> 29#include <unistd.h>
@@ -33,6 +32,7 @@
33#include <ctype.h> 32#include <ctype.h>
34#include <string.h> 33#include <string.h>
35#include <sys/ioctl.h> 34#include <sys/ioctl.h>
35#include "busybox.h"
36 36
37#define DEFAULTFBDEV "/dev/fb0" 37#define DEFAULTFBDEV "/dev/fb0"
38#define DEFAULTFBMODE "/etc/fb.modes" 38#define DEFAULTFBMODE "/etc/fb.modes"
diff --git a/fdflush.c b/fdflush.c
index f10cceae0..28f5cb68a 100644
--- a/fdflush.c
+++ b/fdflush.c
@@ -21,11 +21,11 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <sys/ioctl.h> 25#include <sys/ioctl.h>
27#include <fcntl.h> 26#include <fcntl.h>
28#include <stdlib.h> 27#include <stdlib.h>
28#include "busybox.h"
29 29
30/* From <linux/fd.h> */ 30/* From <linux/fd.h> */
31#define FDFLUSH _IO(2,0x4b) 31#define FDFLUSH _IO(2,0x4b)
diff --git a/find.c b/find.c
index a07dc8ecb..15e693ab9 100644
--- a/find.c
+++ b/find.c
@@ -24,7 +24,6 @@
24 * 24 *
25 */ 25 */
26 26
27#include "busybox.h"
28#include <stdio.h> 27#include <stdio.h>
29#include <unistd.h> 28#include <unistd.h>
30#include <dirent.h> 29#include <dirent.h>
@@ -33,6 +32,7 @@
33#include <fnmatch.h> 32#include <fnmatch.h>
34#include <time.h> 33#include <time.h>
35#include <ctype.h> 34#include <ctype.h>
35#include "busybox.h"
36 36
37 37
38static char *pattern; 38static char *pattern;
diff --git a/findutils/find.c b/findutils/find.c
index a07dc8ecb..15e693ab9 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -24,7 +24,6 @@
24 * 24 *
25 */ 25 */
26 26
27#include "busybox.h"
28#include <stdio.h> 27#include <stdio.h>
29#include <unistd.h> 28#include <unistd.h>
30#include <dirent.h> 29#include <dirent.h>
@@ -33,6 +32,7 @@
33#include <fnmatch.h> 32#include <fnmatch.h>
34#include <time.h> 33#include <time.h>
35#include <ctype.h> 34#include <ctype.h>
35#include "busybox.h"
36 36
37 37
38static char *pattern; 38static char *pattern;
diff --git a/findutils/which.c b/findutils/which.c
index 1908db30a..f9d51f2f3 100644
--- a/findutils/which.c
+++ b/findutils/which.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <string.h> 24#include <string.h>
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int which_main(int argc, char **argv) 29extern int which_main(int argc, char **argv)
30{ 30{
diff --git a/findutils/xargs.c b/findutils/xargs.c
index f05efd917..01aa5be69 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <string.h> 26#include <string.h>
27#include "busybox.h"
28 28
29int xargs_main(int argc, char **argv) 29int xargs_main(int argc, char **argv)
30{ 30{
diff --git a/free.c b/free.c
index d287c03f5..41e872d12 100644
--- a/free.c
+++ b/free.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <errno.h> 25#include <errno.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int free_main(int argc, char **argv) 29extern int free_main(int argc, char **argv)
30{ 30{
diff --git a/fsck_minix.c b/fsck_minix.c
index 2b4c65144..9a53a705e 100644
--- a/fsck_minix.c
+++ b/fsck_minix.c
@@ -86,7 +86,6 @@
86 * enforced (but it's not much fun on a character device :-). 86 * enforced (but it's not much fun on a character device :-).
87 */ 87 */
88 88
89#include "busybox.h"
90#include <stdio.h> 89#include <stdio.h>
91#include <errno.h> 90#include <errno.h>
92#include <unistd.h> 91#include <unistd.h>
@@ -97,6 +96,7 @@
97#include <termios.h> 96#include <termios.h>
98#include <mntent.h> 97#include <mntent.h>
99#include <sys/param.h> 98#include <sys/param.h>
99#include "busybox.h"
100 100
101 101
102 typedef unsigned char u8; 102 typedef unsigned char u8;
diff --git a/gunzip.c b/gunzip.c
index bf8812dbd..8100003ec 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -57,7 +57,6 @@ static char *license_msg[] = {
57}; 57};
58#endif 58#endif
59 59
60#include "busybox.h"
61#include <getopt.h> 60#include <getopt.h>
62#include <ctype.h> 61#include <ctype.h>
63#include <sys/types.h> 62#include <sys/types.h>
@@ -71,6 +70,7 @@ static char *license_msg[] = {
71#include <stdlib.h> 70#include <stdlib.h>
72#include <time.h> 71#include <time.h>
73#include <dirent.h> 72#include <dirent.h>
73#include "busybox.h"
74#define BB_DECLARE_EXTERN 74#define BB_DECLARE_EXTERN
75#define bb_need_memory_exhausted 75#define bb_need_memory_exhausted
76#define bb_need_name_too_long 76#define bb_need_name_too_long
diff --git a/gzip.c b/gzip.c
index 3cbef4ec1..6c058d2b6 100644
--- a/gzip.c
+++ b/gzip.c
@@ -29,11 +29,6 @@
29 * 29 *
30 */ 30 */
31 31
32#include "busybox.h"
33#define BB_DECLARE_EXTERN
34#define bb_need_memory_exhausted
35#include "messages.c"
36
37/* These defines are very important for BusyBox. Without these, 32/* These defines are very important for BusyBox. Without these,
38 * huge chunks of ram are pre-allocated making the BusyBox bss 33 * huge chunks of ram are pre-allocated making the BusyBox bss
39 * size Freaking Huge(tm), which is a bad thing.*/ 34 * size Freaking Huge(tm), which is a bad thing.*/
@@ -43,9 +38,15 @@
43/* I don't like nested includes, but the string and io functions are used 38/* I don't like nested includes, but the string and io functions are used
44 * too often 39 * too often
45 */ 40 */
41#include <stdlib.h>
46#include <stdio.h> 42#include <stdio.h>
47#include <string.h> 43#include <string.h>
48#include <unistd.h> 44#include <unistd.h>
45#include "busybox.h"
46#define BB_DECLARE_EXTERN
47#define bb_need_memory_exhausted
48#include "messages.c"
49
49#define memzero(s, n) memset ((void *)(s), 0, (n)) 50#define memzero(s, n) memset ((void *)(s), 0, (n))
50 51
51#ifndef RETSIGTYPE 52#ifndef RETSIGTYPE
@@ -1628,12 +1629,6 @@ ulg deflate()
1628# include <unistd.h> 1629# include <unistd.h>
1629#endif 1630#endif
1630 1631
1631#if defined(STDC_HEADERS) || !defined(NO_STDLIB_H)
1632# include <stdlib.h>
1633#else
1634extern int errno;
1635#endif
1636
1637#if defined(DIRENT) 1632#if defined(DIRENT)
1638# include <dirent.h> 1633# include <dirent.h>
1639typedef struct dirent dir_type; 1634typedef struct dirent dir_type;
@@ -3098,12 +3093,6 @@ local void set_file_type()
3098# include <fcntl.h> 3093# include <fcntl.h>
3099#endif 3094#endif
3100 3095
3101#if defined(STDC_HEADERS) || !defined(NO_STDLIB_H)
3102# include <stdlib.h>
3103#else
3104extern int errno;
3105#endif
3106
3107/* =========================================================================== 3096/* ===========================================================================
3108 * Copy input to output unchanged: zcat == cat with --force. 3097 * Copy input to output unchanged: zcat == cat with --force.
3109 * IN assertion: insize bytes have already been read in inbuf. 3098 * IN assertion: insize bytes have already been read in inbuf.
diff --git a/head.c b/head.c
index a2d774437..c683ec78a 100644
--- a/head.c
+++ b/head.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <errno.h> 25#include <errno.h>
27#include <stdio.h> 26#include <stdio.h>
28#include <getopt.h> 27#include <getopt.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31int head(int len, FILE *fp) 31int head(int len, FILE *fp)
32{ 32{
diff --git a/hostid.c b/hostid.c
index eed1a50ec..68a2cc659 100644
--- a/hostid.c
+++ b/hostid.c
@@ -20,10 +20,10 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
26#include "busybox.h"
27 27
28extern int hostid_main(int argc, char **argv) 28extern int hostid_main(int argc, char **argv)
29{ 29{
diff --git a/ifconfig.c b/ifconfig.c
index 66615a2fd..a3e2c0fdb 100644
--- a/ifconfig.c
+++ b/ifconfig.c
@@ -15,17 +15,16 @@
15 * Foundation; either version 2 of the License, or (at 15 * Foundation; either version 2 of the License, or (at
16 * your option) any later version. 16 * your option) any later version.
17 * 17 *
18 * $Id: ifconfig.c,v 1.2 2001/02/14 21:23:06 andersen Exp $ 18 * $Id: ifconfig.c,v 1.3 2001/02/20 06:14:07 andersen Exp $
19 * 19 *
20 */ 20 */
21 21
22#include "busybox.h"
23#include <sys/types.h>
24#include <stdio.h> 22#include <stdio.h>
25#include <stdlib.h> 23#include <stdlib.h>
26#include <errno.h> 24#include <errno.h>
27#include <string.h> // strcmp and friends 25#include <string.h> // strcmp and friends
28#include <ctype.h> // isdigit and friends 26#include <ctype.h> // isdigit and friends
27#include <sys/types.h>
29#include <sys/socket.h> 28#include <sys/socket.h>
30#include <sys/ioctl.h> 29#include <sys/ioctl.h>
31#include <netinet/in.h> 30#include <netinet/in.h>
@@ -33,6 +32,7 @@
33#include <net/if.h> 32#include <net/if.h>
34#include <net/if_arp.h> 33#include <net/if_arp.h>
35#include <linux/if_ether.h> 34#include <linux/if_ether.h>
35#include "busybox.h"
36 36
37static int sockfd; /* socket fd we use to manipulate stuff with */ 37static int sockfd; /* socket fd we use to manipulate stuff with */
38 38
diff --git a/init.c b/init.c
index 9046a14a8..1332a1064 100644
--- a/init.c
+++ b/init.c
@@ -27,7 +27,6 @@
27#define DEBUG_INIT 27#define DEBUG_INIT
28*/ 28*/
29 29
30#include "busybox.h"
31#include <stdio.h> 30#include <stdio.h>
32#include <stdlib.h> 31#include <stdlib.h>
33#include <errno.h> 32#include <errno.h>
@@ -43,13 +42,14 @@
43#include <sys/mount.h> 42#include <sys/mount.h>
44#include <sys/types.h> 43#include <sys/types.h>
45#include <sys/wait.h> 44#include <sys/wait.h>
45#include "busybox.h"
46#define bb_need_full_version
47#define BB_DECLARE_EXTERN
48#include "messages.c"
46#ifdef BB_SYSLOGD 49#ifdef BB_SYSLOGD
47# include <sys/syslog.h> 50# include <sys/syslog.h>
48#endif 51#endif
49 52
50#define bb_need_full_version
51#define BB_DECLARE_EXTERN
52#include "messages.c"
53 53
54/* From <linux/vt.h> */ 54/* From <linux/vt.h> */
55struct vt_stat { 55struct vt_stat {
diff --git a/init/init.c b/init/init.c
index 9046a14a8..1332a1064 100644
--- a/init/init.c
+++ b/init/init.c
@@ -27,7 +27,6 @@
27#define DEBUG_INIT 27#define DEBUG_INIT
28*/ 28*/
29 29
30#include "busybox.h"
31#include <stdio.h> 30#include <stdio.h>
32#include <stdlib.h> 31#include <stdlib.h>
33#include <errno.h> 32#include <errno.h>
@@ -43,13 +42,14 @@
43#include <sys/mount.h> 42#include <sys/mount.h>
44#include <sys/types.h> 43#include <sys/types.h>
45#include <sys/wait.h> 44#include <sys/wait.h>
45#include "busybox.h"
46#define bb_need_full_version
47#define BB_DECLARE_EXTERN
48#include "messages.c"
46#ifdef BB_SYSLOGD 49#ifdef BB_SYSLOGD
47# include <sys/syslog.h> 50# include <sys/syslog.h>
48#endif 51#endif
49 52
50#define bb_need_full_version
51#define BB_DECLARE_EXTERN
52#include "messages.c"
53 53
54/* From <linux/vt.h> */ 54/* From <linux/vt.h> */
55struct vt_stat { 55struct vt_stat {
diff --git a/insmod.c b/insmod.c
index 58273521f..166f0fc4b 100644
--- a/insmod.c
+++ b/insmod.c
@@ -37,7 +37,6 @@
37 * 37 *
38 */ 38 */
39 39
40#include "busybox.h"
41#include <stdlib.h> 40#include <stdlib.h>
42#include <stdio.h> 41#include <stdio.h>
43#include <stddef.h> 42#include <stddef.h>
@@ -51,6 +50,7 @@
51#include <sys/utsname.h> 50#include <sys/utsname.h>
52#include <sys/syscall.h> 51#include <sys/syscall.h>
53#include <linux/unistd.h> 52#include <linux/unistd.h>
53#include "busybox.h"
54 54
55//---------------------------------------------------------------------------- 55//----------------------------------------------------------------------------
56//--------modutils module.h, lines 45-242 56//--------modutils module.h, lines 45-242
@@ -81,7 +81,7 @@
81#ifndef MODUTILS_MODULE_H 81#ifndef MODUTILS_MODULE_H
82static const int MODUTILS_MODULE_H = 1; 82static const int MODUTILS_MODULE_H = 1;
83 83
84#ident "$Id: insmod.c,v 1.47 2001/02/15 19:07:43 andersen Exp $" 84#ident "$Id: insmod.c,v 1.48 2001/02/20 06:14:07 andersen Exp $"
85 85
86/* This file contains the structures used by the 2.0 and 2.1 kernels. 86/* This file contains the structures used by the 2.0 and 2.1 kernels.
87 We do not use the kernel headers directly because we do not wish 87 We do not use the kernel headers directly because we do not wish
@@ -287,7 +287,7 @@ int delete_module(const char *);
287#ifndef MODUTILS_OBJ_H 287#ifndef MODUTILS_OBJ_H
288static const int MODUTILS_OBJ_H = 1; 288static const int MODUTILS_OBJ_H = 1;
289 289
290#ident "$Id: insmod.c,v 1.47 2001/02/15 19:07:43 andersen Exp $" 290#ident "$Id: insmod.c,v 1.48 2001/02/20 06:14:07 andersen Exp $"
291 291
292/* The relocatable object is manipulated using elfin types. */ 292/* The relocatable object is manipulated using elfin types. */
293 293
diff --git a/kill.c b/kill.c
index bdd22b52d..e62503b3c 100644
--- a/kill.c
+++ b/kill.c
@@ -21,7 +21,6 @@
21 */ 21 */
22 22
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <errno.h> 26#include <errno.h>
@@ -30,6 +29,7 @@
30#include <ctype.h> 29#include <ctype.h>
31#include <string.h> 30#include <string.h>
32#include <unistd.h> 31#include <unistd.h>
32#include "busybox.h"
33 33
34static const int KILL = 0; 34static const int KILL = 0;
35static const int KILLALL = 1; 35static const int KILLALL = 1;
diff --git a/length.c b/length.c
index 9119adca8..73becd28a 100644
--- a/length.c
+++ b/length.c
@@ -1,8 +1,8 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <stdlib.h> 2#include <stdlib.h>
4#include <string.h> 3#include <string.h>
5#include <stdio.h> 4#include <stdio.h>
5#include "busybox.h"
6 6
7extern int length_main(int argc, char **argv) 7extern int length_main(int argc, char **argv)
8{ 8{
diff --git a/ln.c b/ln.c
index e35bf7a03..6d41cce62 100644
--- a/ln.c
+++ b/ln.c
@@ -21,17 +21,17 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#define BB_DECLARE_EXTERN
26#define bb_need_not_a_directory
27#include "messages.c"
28
29#include <stdio.h> 24#include <stdio.h>
30#include <dirent.h> 25#include <dirent.h>
31#include <string.h> 26#include <string.h>
32#include <stdlib.h> 27#include <stdlib.h>
33#include <errno.h> 28#include <errno.h>
34#include <unistd.h> 29#include <unistd.h>
30#include "busybox.h"
31#define BB_DECLARE_EXTERN
32#define bb_need_not_a_directory
33#include "messages.c"
34
35 35
36static const int LN_SYMLINK = 1; 36static const int LN_SYMLINK = 1;
37static const int LN_FORCE = 2; 37static const int LN_FORCE = 2;
diff --git a/loadacm.c b/loadacm.c
index 6422137a1..81b973b02 100644
--- a/loadacm.c
+++ b/loadacm.c
@@ -7,7 +7,6 @@
7 * Peter Novodvorsky <petya@logic.ru> 7 * Peter Novodvorsky <petya@logic.ru>
8 */ 8 */
9 9
10#include "busybox.h"
11#include <stdio.h> 10#include <stdio.h>
12#include <stdlib.h> 11#include <stdlib.h>
13#include <memory.h> 12#include <memory.h>
@@ -17,9 +16,10 @@
17#include <assert.h> 16#include <assert.h>
18#include <errno.h> 17#include <errno.h>
19#include <signal.h> 18#include <signal.h>
19#include <sys/kd.h>
20#include <sys/types.h> 20#include <sys/types.h>
21#include <sys/ioctl.h> 21#include <sys/ioctl.h>
22#include <sys/kd.h> 22#include "busybox.h"
23 23
24typedef unsigned short unicode; 24typedef unsigned short unicode;
25 25
diff --git a/loadfont.c b/loadfont.c
index d7bd7e8f5..1a724ca85 100644
--- a/loadfont.c
+++ b/loadfont.c
@@ -7,7 +7,6 @@
7 * Loads the console font, and possibly the corresponding screen map(s). 7 * Loads the console font, and possibly the corresponding screen map(s).
8 * (Adapted for busybox by Matej Vela.) 8 * (Adapted for busybox by Matej Vela.)
9 */ 9 */
10#include "busybox.h"
11#include <stdio.h> 10#include <stdio.h>
12#include <string.h> 11#include <string.h>
13#include <fcntl.h> 12#include <fcntl.h>
@@ -20,6 +19,7 @@
20#include <sys/ioctl.h> 19#include <sys/ioctl.h>
21#include <sys/kd.h> 20#include <sys/kd.h>
22#include <endian.h> 21#include <endian.h>
22#include "busybox.h"
23 23
24static const int PSF_MAGIC1 = 0x36; 24static const int PSF_MAGIC1 = 0x36;
25static const int PSF_MAGIC2 = 0x04; 25static const int PSF_MAGIC2 = 0x04;
diff --git a/loadkmap.c b/loadkmap.c
index 5ecd819f9..dcb5c1caa 100644
--- a/loadkmap.c
+++ b/loadkmap.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <errno.h> 23#include <errno.h>
25#include <fcntl.h> 24#include <fcntl.h>
26#include <stdio.h> 25#include <stdio.h>
@@ -28,6 +27,7 @@
28#include <stdlib.h> 27#include <stdlib.h>
29#include <unistd.h> 28#include <unistd.h>
30#include <sys/ioctl.h> 29#include <sys/ioctl.h>
30#include "busybox.h"
31 31
32#define BINARY_KEYMAP_MAGIC "bkeymap" 32#define BINARY_KEYMAP_MAGIC "bkeymap"
33 33
diff --git a/logger.c b/logger.c
index 352bde158..1218d8d2e 100644
--- a/logger.c
+++ b/logger.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <unistd.h> 25#include <unistd.h>
27#include <sys/types.h> 26#include <sys/types.h>
@@ -30,6 +29,7 @@
30#include <string.h> 29#include <string.h>
31#include <stdlib.h> 30#include <stdlib.h>
32 31
32#include "busybox.h"
33#if !defined BB_SYSLOGD 33#if !defined BB_SYSLOGD
34 34
35#define SYSLOG_NAMES 35#define SYSLOG_NAMES
@@ -40,6 +40,7 @@
40 * structures. Argh.... bad libc, bad, bad... 40 * structures. Argh.... bad libc, bad, bad...
41 */ 41 */
42#include <sys/syslog.h> 42#include <sys/syslog.h>
43
43typedef struct _code { 44typedef struct _code {
44 char *c_name; 45 char *c_name;
45 int c_val; 46 int c_val;
diff --git a/logname.c b/logname.c
index a1887aaf9..0924b2471 100644
--- a/logname.c
+++ b/logname.c
@@ -20,10 +20,10 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
26#include "busybox.h"
27 27
28extern int logname_main(int argc, char **argv) 28extern int logname_main(int argc, char **argv)
29{ 29{
diff --git a/ls.c b/ls.c
index dd38dd5f3..a619bb8b2 100644
--- a/ls.c
+++ b/ls.c
@@ -50,7 +50,6 @@ enum {
50 50
51/************************************************************************/ 51/************************************************************************/
52 52
53#include "busybox.h"
54#include <sys/types.h> 53#include <sys/types.h>
55#include <sys/stat.h> 54#include <sys/stat.h>
56#include <stdio.h> 55#include <stdio.h>
@@ -67,6 +66,7 @@ enum {
67#include <fcntl.h> 66#include <fcntl.h>
68#include <signal.h> 67#include <signal.h>
69#include <sys/ioctl.h> 68#include <sys/ioctl.h>
69#include "busybox.h"
70 70
71#ifndef MAJOR 71#ifndef MAJOR
72#define MAJOR(dev) (((dev)>>8)&0xff) 72#define MAJOR(dev) (((dev)>>8)&0xff)
diff --git a/lsmod.c b/lsmod.c
index f39cbc08f..c97d199a6 100644
--- a/lsmod.c
+++ b/lsmod.c
@@ -25,7 +25,6 @@
25 * 25 *
26 */ 26 */
27 27
28#include "busybox.h"
29#include <stdlib.h> 28#include <stdlib.h>
30#include <stdio.h> 29#include <stdio.h>
31#include <stddef.h> 30#include <stddef.h>
@@ -37,6 +36,7 @@
37#include <getopt.h> 36#include <getopt.h>
38#include <sys/utsname.h> 37#include <sys/utsname.h>
39#include <sys/file.h> 38#include <sys/file.h>
39#include "busybox.h"
40 40
41 41
42 42
diff --git a/makedevs.c b/makedevs.c
index eed3968c8..b8c6dd1d8 100644
--- a/makedevs.c
+++ b/makedevs.c
@@ -7,13 +7,13 @@
7 * known bugs: can't deal with alpha ranges 7 * known bugs: can't deal with alpha ranges
8 */ 8 */
9 9
10#include "busybox.h"
11#include <stdio.h> 10#include <stdio.h>
12#include <stdlib.h> 11#include <stdlib.h>
13#include <string.h> 12#include <string.h>
14#include <fcntl.h> 13#include <fcntl.h>
15#include <unistd.h> 14#include <unistd.h>
16#include <sys/types.h> 15#include <sys/types.h>
16#include "busybox.h"
17 17
18int makedevs_main(int argc, char **argv) 18int makedevs_main(int argc, char **argv)
19{ 19{
diff --git a/md5sum.c b/md5sum.c
index 3decafdf4..fa11ee61d 100644
--- a/md5sum.c
+++ b/md5sum.c
@@ -20,11 +20,11 @@
20/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu> */ 20/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu> */
21/* Hacked to work with BusyBox by Alfred M. Szmidt <ams@trillian.itslinux.org> */ 21/* Hacked to work with BusyBox by Alfred M. Szmidt <ams@trillian.itslinux.org> */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <errno.h> 24#include <errno.h>
26#include <ctype.h> 25#include <ctype.h>
27#include <getopt.h> 26#include <getopt.h>
27#include "busybox.h"
28 28
29/* For some silly reason, this file uses backwards TRUE and FALSE conventions */ 29/* For some silly reason, this file uses backwards TRUE and FALSE conventions */
30#undef TRUE 30#undef TRUE
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 1e34574ed..a422139b1 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -1,10 +1,10 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <ctype.h> 2#include <ctype.h>
4#include <stdio.h> 3#include <stdio.h>
5#include <stdlib.h> 4#include <stdlib.h>
6#include <unistd.h> 5#include <unistd.h>
7#include <math.h> 6#include <math.h>
7#include "busybox.h"
8 8
9/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */ 9/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */
10 10
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c
index 2e6b3c056..a75a6e392 100644
--- a/miscutils/dutmp.c
+++ b/miscutils/dutmp.c
@@ -12,17 +12,17 @@
12 * Erik Andersen <andersen@lineo.com> 12 * Erik Andersen <andersen@lineo.com>
13 */ 13 */
14 14
15#include "busybox.h"
16#include <sys/types.h> 15#include <sys/types.h>
17#include <fcntl.h> 16#include <fcntl.h>
18 17
19#include <errno.h> 18#include <errno.h>
20#define BB_DECLARE_EXTERN
21#define bb_need_io_error
22#include "messages.c"
23#include <utmp.h> 19#include <utmp.h>
24#include <stdlib.h> 20#include <stdlib.h>
25#include <unistd.h> 21#include <unistd.h>
22#include "busybox.h"
23#define BB_DECLARE_EXTERN
24#define bb_need_io_error
25#include "messages.c"
26 26
27extern int dutmp_main(int argc, char **argv) 27extern int dutmp_main(int argc, char **argv)
28{ 28{
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index eed3968c8..b8c6dd1d8 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -7,13 +7,13 @@
7 * known bugs: can't deal with alpha ranges 7 * known bugs: can't deal with alpha ranges
8 */ 8 */
9 9
10#include "busybox.h"
11#include <stdio.h> 10#include <stdio.h>
12#include <stdlib.h> 11#include <stdlib.h>
13#include <string.h> 12#include <string.h>
14#include <fcntl.h> 13#include <fcntl.h>
15#include <unistd.h> 14#include <unistd.h>
16#include <sys/types.h> 15#include <sys/types.h>
16#include "busybox.h"
17 17
18int makedevs_main(int argc, char **argv) 18int makedevs_main(int argc, char **argv)
19{ 19{
diff --git a/miscutils/mktemp.c b/miscutils/mktemp.c
index b3522026e..31ab9e228 100644
--- a/miscutils/mktemp.c
+++ b/miscutils/mktemp.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <errno.h> 26#include <errno.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31extern int mktemp_main(int argc, char **argv) 31extern int mktemp_main(int argc, char **argv)
32{ 32{
diff --git a/miscutils/mt.c b/miscutils/mt.c
index eb93cb234..350d3ae5a 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -1,9 +1,9 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <stdio.h> 2#include <stdio.h>
4#include <stdlib.h> 3#include <stdlib.h>
5#include <sys/mtio.h> 4#include <sys/mtio.h>
6#include <sys/fcntl.h> 5#include <sys/fcntl.h>
6#include "busybox.h"
7 7
8struct mt_opcodes { 8struct mt_opcodes {
9 char *name; 9 char *name;
diff --git a/miscutils/readlink.c b/miscutils/readlink.c
index c82f64027..74196e11d 100644
--- a/miscutils/readlink.c
+++ b/miscutils/readlink.c
@@ -22,10 +22,10 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <errno.h> 25#include <errno.h>
27#include <unistd.h> 26#include <unistd.h>
28#include <stdlib.h> 27#include <stdlib.h>
28#include "busybox.h"
29 29
30int readlink_main(int argc, char **argv) 30int readlink_main(int argc, char **argv)
31{ 31{
diff --git a/miscutils/update.c b/miscutils/update.c
index 2cf4a98b2..b282b9e18 100644
--- a/miscutils/update.c
+++ b/miscutils/update.c
@@ -28,7 +28,6 @@
28 * earlier) kernel. 2.2.x and higher flush filesystem buffers automatically. 28 * earlier) kernel. 2.2.x and higher flush filesystem buffers automatically.
29 */ 29 */
30 30
31#include "busybox.h"
32#include <sys/param.h> 31#include <sys/param.h>
33#include <sys/syslog.h> 32#include <sys/syslog.h>
34#include <unistd.h> /* for getopt() */ 33#include <unistd.h> /* for getopt() */
@@ -42,6 +41,7 @@
42#include <linux/unistd.h> 41#include <linux/unistd.h>
43static _syscall2(int, bdflush, int, func, int, data); 42static _syscall2(int, bdflush, int, func, int, data);
44#endif /* __GLIBC__ */ 43#endif /* __GLIBC__ */
44#include "busybox.h"
45 45
46static unsigned int sync_duration = 30; 46static unsigned int sync_duration = 30;
47static unsigned int flush_duration = 5; 47static unsigned int flush_duration = 5;
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index 65d0fc35f..5b5fd6953 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -20,11 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <fcntl.h> 24#include <fcntl.h>
26#include <unistd.h> 25#include <unistd.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int watchdog_main(int argc, char **argv) 29extern int watchdog_main(int argc, char **argv)
30{ 30{
diff --git a/mkdir.c b/mkdir.c
index 285d34f12..902da7c99 100644
--- a/mkdir.c
+++ b/mkdir.c
@@ -21,15 +21,15 @@
21 * 21 *
22 */ 22 */
23 23
24#include <stdio.h>
25#include <errno.h>
26#include <string.h>
27#include <stdlib.h>
24#include "busybox.h" 28#include "busybox.h"
25#define bb_need_name_too_long 29#define bb_need_name_too_long
26#define BB_DECLARE_EXTERN 30#define BB_DECLARE_EXTERN
27#include "messages.c" 31#include "messages.c"
28 32
29#include <stdio.h>
30#include <errno.h>
31#include <string.h>
32#include <stdlib.h>
33 33
34static int parentFlag = FALSE; 34static int parentFlag = FALSE;
35static mode_t mode = 0777; 35static mode_t mode = 0777;
diff --git a/mkfifo.c b/mkfifo.c
index 56a04f772..ca217fa23 100644
--- a/mkfifo.c
+++ b/mkfifo.c
@@ -20,11 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <sys/types.h> 24#include <sys/types.h>
26#include <errno.h> 25#include <errno.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int mkfifo_main(int argc, char **argv) 29extern int mkfifo_main(int argc, char **argv)
30{ 30{
diff --git a/mkfs_minix.c b/mkfs_minix.c
index 6b4a3e2d1..b666338dc 100644
--- a/mkfs_minix.c
+++ b/mkfs_minix.c
@@ -62,7 +62,6 @@
62 * removed getopt based parser and added a hand rolled one. 62 * removed getopt based parser and added a hand rolled one.
63 */ 63 */
64 64
65#include "busybox.h"
66#include <stdio.h> 65#include <stdio.h>
67#include <time.h> 66#include <time.h>
68#include <unistd.h> 67#include <unistd.h>
@@ -75,6 +74,7 @@
75#include <sys/ioctl.h> 74#include <sys/ioctl.h>
76#include <sys/param.h> 75#include <sys/param.h>
77#include <mntent.h> 76#include <mntent.h>
77#include "busybox.h"
78 78
79 79
80typedef unsigned char u8; 80typedef unsigned char u8;
diff --git a/mknod.c b/mknod.c
index 73f6e06f1..b4d4b82a1 100644
--- a/mknod.c
+++ b/mknod.c
@@ -20,14 +20,14 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <errno.h> 24#include <errno.h>
26#include <sys/types.h>
27#include <fcntl.h> 25#include <fcntl.h>
28#include <unistd.h> 26#include <unistd.h>
29#include <string.h> 27#include <string.h>
30#include <stdlib.h> 28#include <stdlib.h>
29#include <sys/types.h>
30#include "busybox.h"
31 31
32int mknod_main(int argc, char **argv) 32int mknod_main(int argc, char **argv)
33{ 33{
diff --git a/mkswap.c b/mkswap.c
index 48637e889..b5153f623 100644
--- a/mkswap.c
+++ b/mkswap.c
@@ -35,7 +35,6 @@
35 * 35 *
36 */ 36 */
37 37
38#include "busybox.h"
39#include <stdio.h> 38#include <stdio.h>
40#include <unistd.h> 39#include <unistd.h>
41#include <string.h> 40#include <string.h>
@@ -45,6 +44,7 @@
45#include <sys/utsname.h> 44#include <sys/utsname.h>
46#include <asm/page.h> /* for PAGE_SIZE and PAGE_SHIFT */ 45#include <asm/page.h> /* for PAGE_SIZE and PAGE_SHIFT */
47 /* we also get PAGE_SIZE via getpagesize() */ 46 /* we also get PAGE_SIZE via getpagesize() */
47#include "busybox.h"
48 48
49#ifndef _IO 49#ifndef _IO
50/* pre-1.3.45 */ 50/* pre-1.3.45 */
diff --git a/mktemp.c b/mktemp.c
index b3522026e..31ab9e228 100644
--- a/mktemp.c
+++ b/mktemp.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <errno.h> 26#include <errno.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31extern int mktemp_main(int argc, char **argv) 31extern int mktemp_main(int argc, char **argv)
32{ 32{
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 58273521f..166f0fc4b 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -37,7 +37,6 @@
37 * 37 *
38 */ 38 */
39 39
40#include "busybox.h"
41#include <stdlib.h> 40#include <stdlib.h>
42#include <stdio.h> 41#include <stdio.h>
43#include <stddef.h> 42#include <stddef.h>
@@ -51,6 +50,7 @@
51#include <sys/utsname.h> 50#include <sys/utsname.h>
52#include <sys/syscall.h> 51#include <sys/syscall.h>
53#include <linux/unistd.h> 52#include <linux/unistd.h>
53#include "busybox.h"
54 54
55//---------------------------------------------------------------------------- 55//----------------------------------------------------------------------------
56//--------modutils module.h, lines 45-242 56//--------modutils module.h, lines 45-242
@@ -81,7 +81,7 @@
81#ifndef MODUTILS_MODULE_H 81#ifndef MODUTILS_MODULE_H
82static const int MODUTILS_MODULE_H = 1; 82static const int MODUTILS_MODULE_H = 1;
83 83
84#ident "$Id: insmod.c,v 1.47 2001/02/15 19:07:43 andersen Exp $" 84#ident "$Id: insmod.c,v 1.48 2001/02/20 06:14:07 andersen Exp $"
85 85
86/* This file contains the structures used by the 2.0 and 2.1 kernels. 86/* This file contains the structures used by the 2.0 and 2.1 kernels.
87 We do not use the kernel headers directly because we do not wish 87 We do not use the kernel headers directly because we do not wish
@@ -287,7 +287,7 @@ int delete_module(const char *);
287#ifndef MODUTILS_OBJ_H 287#ifndef MODUTILS_OBJ_H
288static const int MODUTILS_OBJ_H = 1; 288static const int MODUTILS_OBJ_H = 1;
289 289
290#ident "$Id: insmod.c,v 1.47 2001/02/15 19:07:43 andersen Exp $" 290#ident "$Id: insmod.c,v 1.48 2001/02/20 06:14:07 andersen Exp $"
291 291
292/* The relocatable object is manipulated using elfin types. */ 292/* The relocatable object is manipulated using elfin types. */
293 293
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index f39cbc08f..c97d199a6 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -25,7 +25,6 @@
25 * 25 *
26 */ 26 */
27 27
28#include "busybox.h"
29#include <stdlib.h> 28#include <stdlib.h>
30#include <stdio.h> 29#include <stdio.h>
31#include <stddef.h> 30#include <stddef.h>
@@ -37,6 +36,7 @@
37#include <getopt.h> 36#include <getopt.h>
38#include <sys/utsname.h> 37#include <sys/utsname.h>
39#include <sys/file.h> 38#include <sys/file.h>
39#include "busybox.h"
40 40
41 41
42 42
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index 7d4538e6e..aab326123 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -21,13 +21,13 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <errno.h> 25#include <errno.h>
27#include <unistd.h> 26#include <unistd.h>
28#include <stdlib.h> 27#include <stdlib.h>
29#include <sys/syscall.h> 28#include <sys/syscall.h>
30#include <linux/unistd.h> 29#include <linux/unistd.h>
30#include "busybox.h"
31#define __LIBRARY__ 31#define __LIBRARY__
32 32
33 33
diff --git a/more.c b/more.c
index c4c74fe4a..298e1cfb1 100644
--- a/more.c
+++ b/more.c
@@ -25,12 +25,12 @@
25 * 25 *
26 */ 26 */
27 27
28#include "busybox.h"
29#include <stdio.h> 28#include <stdio.h>
30#include <fcntl.h> 29#include <fcntl.h>
31#include <signal.h> 30#include <signal.h>
32#include <stdlib.h> 31#include <stdlib.h>
33#include <sys/ioctl.h> 32#include <sys/ioctl.h>
33#include "busybox.h"
34#define BB_DECLARE_EXTERN 34#define BB_DECLARE_EXTERN
35#define bb_need_help 35#define bb_need_help
36#include "messages.c" 36#include "messages.c"
diff --git a/mount.c b/mount.c
index 2f5bba59d..7b0bf3e21 100644
--- a/mount.c
+++ b/mount.c
@@ -43,7 +43,6 @@
43 * 43 *
44 */ 44 */
45 45
46#include "busybox.h"
47#include <stdlib.h> 46#include <stdlib.h>
48#include <unistd.h> 47#include <unistd.h>
49#include <errno.h> 48#include <errno.h>
@@ -54,6 +53,7 @@
54#if defined BB_FEATURE_USE_DEVPS_PATCH 53#if defined BB_FEATURE_USE_DEVPS_PATCH
55#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */ 54#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */
56#endif 55#endif
56#include "busybox.h"
57 57
58enum { 58enum {
59 MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */ 59 MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
diff --git a/mt.c b/mt.c
index eb93cb234..350d3ae5a 100644
--- a/mt.c
+++ b/mt.c
@@ -1,9 +1,9 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <stdio.h> 2#include <stdio.h>
4#include <stdlib.h> 3#include <stdlib.h>
5#include <sys/mtio.h> 4#include <sys/mtio.h>
6#include <sys/fcntl.h> 5#include <sys/fcntl.h>
6#include "busybox.h"
7 7
8struct mt_opcodes { 8struct mt_opcodes {
9 char *name; 9 char *name;
diff --git a/mtab.c b/mtab.c
index 33b11c83e..5fb3674a9 100644
--- a/mtab.c
+++ b/mtab.c
@@ -1,5 +1,4 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2#include "busybox.h"
3#include <stdlib.h> 2#include <stdlib.h>
4#include <unistd.h> 3#include <unistd.h>
5#include <errno.h> 4#include <errno.h>
@@ -8,6 +7,7 @@
8#include <mntent.h> 7#include <mntent.h>
9#include <fstab.h> 8#include <fstab.h>
10#include <sys/mount.h> 9#include <sys/mount.h>
10#include "busybox.h"
11 11
12extern const char mtab_file[]; /* Defined in utility.c */ 12extern const char mtab_file[]; /* Defined in utility.c */
13 13
diff --git a/nc.c b/nc.c
index 8927103e0..e40d4b459 100644
--- a/nc.c
+++ b/nc.c
@@ -26,7 +26,6 @@
26 26
27*/ 27*/
28 28
29#include "busybox.h"
30#include <stdio.h> 29#include <stdio.h>
31#include <stdlib.h> 30#include <stdlib.h>
32#include <unistd.h> 31#include <unistd.h>
@@ -38,6 +37,7 @@
38#include <netdb.h> 37#include <netdb.h>
39#include <sys/time.h> 38#include <sys/time.h>
40#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include "busybox.h"
41 41
42int nc_main(int argc, char **argv) 42int nc_main(int argc, char **argv)
43{ 43{
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 66615a2fd..a3e2c0fdb 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -15,17 +15,16 @@
15 * Foundation; either version 2 of the License, or (at 15 * Foundation; either version 2 of the License, or (at
16 * your option) any later version. 16 * your option) any later version.
17 * 17 *
18 * $Id: ifconfig.c,v 1.2 2001/02/14 21:23:06 andersen Exp $ 18 * $Id: ifconfig.c,v 1.3 2001/02/20 06:14:07 andersen Exp $
19 * 19 *
20 */ 20 */
21 21
22#include "busybox.h"
23#include <sys/types.h>
24#include <stdio.h> 22#include <stdio.h>
25#include <stdlib.h> 23#include <stdlib.h>
26#include <errno.h> 24#include <errno.h>
27#include <string.h> // strcmp and friends 25#include <string.h> // strcmp and friends
28#include <ctype.h> // isdigit and friends 26#include <ctype.h> // isdigit and friends
27#include <sys/types.h>
29#include <sys/socket.h> 28#include <sys/socket.h>
30#include <sys/ioctl.h> 29#include <sys/ioctl.h>
31#include <netinet/in.h> 30#include <netinet/in.h>
@@ -33,6 +32,7 @@
33#include <net/if.h> 32#include <net/if.h>
34#include <net/if_arp.h> 33#include <net/if_arp.h>
35#include <linux/if_ether.h> 34#include <linux/if_ether.h>
35#include "busybox.h"
36 36
37static int sockfd; /* socket fd we use to manipulate stuff with */ 37static int sockfd; /* socket fd we use to manipulate stuff with */
38 38
diff --git a/networking/nc.c b/networking/nc.c
index 8927103e0..e40d4b459 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -26,7 +26,6 @@
26 26
27*/ 27*/
28 28
29#include "busybox.h"
30#include <stdio.h> 29#include <stdio.h>
31#include <stdlib.h> 30#include <stdlib.h>
32#include <unistd.h> 31#include <unistd.h>
@@ -38,6 +37,7 @@
38#include <netdb.h> 37#include <netdb.h>
39#include <sys/time.h> 38#include <sys/time.h>
40#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include "busybox.h"
41 41
42int nc_main(int argc, char **argv) 42int nc_main(int argc, char **argv)
43{ 43{
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 33732de68..8791b5efe 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <ctype.h> 24#include <ctype.h>
26#include <errno.h> 25#include <errno.h>
27#include <stdio.h> 26#include <stdio.h>
@@ -32,6 +31,7 @@
32#include <sys/socket.h> 31#include <sys/socket.h>
33#include <sys/types.h> 32#include <sys/types.h>
34#include <netinet/in.h> 33#include <netinet/in.h>
34#include "busybox.h"
35 35
36/* 36/*
37 | I'm only implementing non-interactive mode; 37 | I'm only implementing non-interactive mode;
@@ -170,4 +170,4 @@ int nslookup_main(int argc, char **argv)
170 return EXIT_SUCCESS; 170 return EXIT_SUCCESS;
171} 171}
172 172
173/* $Id: nslookup.c,v 1.21 2001/02/14 21:23:06 andersen Exp $ */ 173/* $Id: nslookup.c,v 1.22 2001/02/20 06:14:08 andersen Exp $ */
diff --git a/networking/ping.c b/networking/ping.c
index c114fb0b3..50c7ce6e6 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.37 2001/02/14 21:23:06 andersen Exp $ 3 * $Id: ping.c,v 1.38 2001/02/20 06:14:08 andersen Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -31,7 +31,6 @@
31 * Original copyright notice is retained at the end of this file. 31 * Original copyright notice is retained at the end of this file.
32 */ 32 */
33 33
34#include "busybox.h"
35#include <sys/param.h> 34#include <sys/param.h>
36#include <sys/socket.h> 35#include <sys/socket.h>
37#include <sys/file.h> 36#include <sys/file.h>
@@ -50,6 +49,7 @@
50#include <unistd.h> 49#include <unistd.h>
51#include <string.h> 50#include <string.h>
52#include <stdlib.h> 51#include <stdlib.h>
52#include "busybox.h"
53 53
54 54
55/* It turns out that libc5 doesn't have proper icmp support 55/* It turns out that libc5 doesn't have proper icmp support
diff --git a/networking/route.c b/networking/route.c
index d98d9a0b6..9be002792 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -15,14 +15,13 @@
15 * Foundation; either version 2 of the License, or (at 15 * Foundation; either version 2 of the License, or (at
16 * your option) any later version. 16 * your option) any later version.
17 * 17 *
18 * $Id: route.c,v 1.6 2001/02/18 20:12:25 andersen Exp $ 18 * $Id: route.c,v 1.7 2001/02/20 06:14:08 andersen Exp $
19 * 19 *
20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> 20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
21 * busybox style adjustments by Larry Doolittle <LRDoolittle@lbl.gov> 21 * busybox style adjustments by Larry Doolittle <LRDoolittle@lbl.gov>
22 * displayroute() format now matches net-tools-1.57/lib/inet_gr.c line 173. 22 * displayroute() format now matches net-tools-1.57/lib/inet_gr.c line 173.
23 */ 23 */
24 24
25#include "busybox.h"
26#include <sys/types.h> 25#include <sys/types.h>
27#include <sys/ioctl.h> 26#include <sys/ioctl.h>
28#include <sys/socket.h> 27#include <sys/socket.h>
@@ -38,6 +37,7 @@
38#include <getopt.h> 37#include <getopt.h>
39#include <unistd.h> 38#include <unistd.h>
40#include <ctype.h> 39#include <ctype.h>
40#include "busybox.h"
41 41
42#define _(x) x 42#define _(x) x
43 43
diff --git a/networking/telnet.c b/networking/telnet.c
index ed92a8403..fd1ace41d 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -30,7 +30,6 @@
30 * 30 *
31 */ 31 */
32 32
33#include "busybox.h"
34#include <termios.h> 33#include <termios.h>
35#include <unistd.h> 34#include <unistd.h>
36#include <errno.h> 35#include <errno.h>
@@ -43,6 +42,7 @@
43#include <sys/socket.h> 42#include <sys/socket.h>
44#include <netinet/in.h> 43#include <netinet/in.h>
45#include <netdb.h> 44#include <netdb.h>
45#include "busybox.h"
46 46
47#if 0 47#if 0
48static const int DOTRACE = 1; 48static const int DOTRACE = 1;
diff --git a/networking/wget.c b/networking/wget.c
index d1aacefa6..4b8392ba5 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16 16
17#include "busybox.h"
18#include <stdio.h> 17#include <stdio.h>
19#include <errno.h> 18#include <errno.h>
20#include <stdlib.h> 19#include <stdlib.h>
@@ -33,6 +32,8 @@
33#include <arpa/inet.h> 32#include <arpa/inet.h>
34#include <netdb.h> 33#include <netdb.h>
35 34
35#include "busybox.h"
36
36/* Stupid libc5 doesn't define this... */ 37/* Stupid libc5 doesn't define this... */
37#ifndef timersub 38#ifndef timersub
38#define timersub(a, b, result) \ 39#define timersub(a, b, result) \
@@ -533,7 +534,7 @@ progressmeter(int flag)
533 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 534 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
534 * SUCH DAMAGE. 535 * SUCH DAMAGE.
535 * 536 *
536 * $Id: wget.c,v 1.27 2001/02/14 21:23:06 andersen Exp $ 537 * $Id: wget.c,v 1.28 2001/02/20 06:14:08 andersen Exp $
537 */ 538 */
538 539
539 540
diff --git a/nfsmount.c b/nfsmount.c
index ae44f3207..aee496980 100644
--- a/nfsmount.c
+++ b/nfsmount.c
@@ -33,25 +33,25 @@
33 * nfsmount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp 33 * nfsmount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp
34 */ 34 */
35 35
36#include "busybox.h"
37#undef FALSE
38#undef TRUE
39#include <unistd.h> 36#include <unistd.h>
40#include <stdio.h> 37#include <stdio.h>
41#include <string.h> 38#include <string.h>
42#include <errno.h> 39#include <errno.h>
43#include <netdb.h> 40#include <netdb.h>
44#include <rpc/rpc.h>
45#include <rpc/pmap_prot.h>
46#include <rpc/pmap_clnt.h>
47#include <sys/socket.h> 41#include <sys/socket.h>
48#include <time.h> 42#include <time.h>
49#include <sys/utsname.h> 43#include <sys/utsname.h>
50#include <netinet/in.h> 44#include <netinet/in.h>
51#include <arpa/inet.h> 45#include <arpa/inet.h>
52 46#include <stdlib.h>
53#include "nfsmount.h" 47#include "busybox.h"
48#undef TRUE
49#undef FALSE
50#include <rpc/rpc.h>
51#include <rpc/pmap_prot.h>
52#include <rpc/pmap_clnt.h>
54#include <linux/nfs.h> /* For the kernels nfs stuff */ 53#include <linux/nfs.h> /* For the kernels nfs stuff */
54#include "nfsmount.h"
55 55
56#ifndef NFS_FHSIZE 56#ifndef NFS_FHSIZE
57static const int NFS_FHSIZE = 32; 57static const int NFS_FHSIZE = 32;
diff --git a/nslookup.c b/nslookup.c
index 33732de68..8791b5efe 100644
--- a/nslookup.c
+++ b/nslookup.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <ctype.h> 24#include <ctype.h>
26#include <errno.h> 25#include <errno.h>
27#include <stdio.h> 26#include <stdio.h>
@@ -32,6 +31,7 @@
32#include <sys/socket.h> 31#include <sys/socket.h>
33#include <sys/types.h> 32#include <sys/types.h>
34#include <netinet/in.h> 33#include <netinet/in.h>
34#include "busybox.h"
35 35
36/* 36/*
37 | I'm only implementing non-interactive mode; 37 | I'm only implementing non-interactive mode;
@@ -170,4 +170,4 @@ int nslookup_main(int argc, char **argv)
170 return EXIT_SUCCESS; 170 return EXIT_SUCCESS;
171} 171}
172 172
173/* $Id: nslookup.c,v 1.21 2001/02/14 21:23:06 andersen Exp $ */ 173/* $Id: nslookup.c,v 1.22 2001/02/20 06:14:08 andersen Exp $ */
diff --git a/ping.c b/ping.c
index c114fb0b3..50c7ce6e6 100644
--- a/ping.c
+++ b/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.37 2001/02/14 21:23:06 andersen Exp $ 3 * $Id: ping.c,v 1.38 2001/02/20 06:14:08 andersen Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -31,7 +31,6 @@
31 * Original copyright notice is retained at the end of this file. 31 * Original copyright notice is retained at the end of this file.
32 */ 32 */
33 33
34#include "busybox.h"
35#include <sys/param.h> 34#include <sys/param.h>
36#include <sys/socket.h> 35#include <sys/socket.h>
37#include <sys/file.h> 36#include <sys/file.h>
@@ -50,6 +49,7 @@
50#include <unistd.h> 49#include <unistd.h>
51#include <string.h> 50#include <string.h>
52#include <stdlib.h> 51#include <stdlib.h>
52#include "busybox.h"
53 53
54 54
55/* It turns out that libc5 doesn't have proper icmp support 55/* It turns out that libc5 doesn't have proper icmp support
diff --git a/pivot_root.c b/pivot_root.c
index e00710148..d7b80d749 100644
--- a/pivot_root.c
+++ b/pivot_root.c
@@ -4,11 +4,11 @@
4 * 4 *
5 * busyboxed by Evin Robertson 5 * busyboxed by Evin Robertson
6 */ 6 */
7#include "busybox.h"
8#include <stdlib.h> 7#include <stdlib.h>
9#include <stdio.h> 8#include <stdio.h>
10#include <sys/syscall.h> 9#include <sys/syscall.h>
11#include <linux/unistd.h> 10#include <linux/unistd.h>
11#include "busybox.h"
12 12
13#ifndef __NR_pivot_root 13#ifndef __NR_pivot_root
14#error Sorry, but this kernel does not support the pivot_root syscall 14#error Sorry, but this kernel does not support the pivot_root syscall
diff --git a/printf.c b/printf.c
index 26a200e85..003423d56 100644
--- a/printf.c
+++ b/printf.c
@@ -47,7 +47,6 @@
47 47
48// 19990508 Busy Boxed! Dave Cinege 48// 19990508 Busy Boxed! Dave Cinege
49 49
50#include "busybox.h"
51#include <unistd.h> 50#include <unistd.h>
52#include <stdio.h> 51#include <stdio.h>
53#include <sys/types.h> 52#include <sys/types.h>
@@ -56,6 +55,7 @@
56#include <stdlib.h> 55#include <stdlib.h>
57#include <fcntl.h> 56#include <fcntl.h>
58#include <ctype.h> 57#include <ctype.h>
58#include "busybox.h"
59 59
60 60
61#ifndef S_IFMT 61#ifndef S_IFMT
diff --git a/procps/free.c b/procps/free.c
index d287c03f5..41e872d12 100644
--- a/procps/free.c
+++ b/procps/free.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <errno.h> 25#include <errno.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int free_main(int argc, char **argv) 29extern int free_main(int argc, char **argv)
30{ 30{
diff --git a/procps/kill.c b/procps/kill.c
index bdd22b52d..e62503b3c 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -21,7 +21,6 @@
21 */ 21 */
22 22
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <errno.h> 26#include <errno.h>
@@ -30,6 +29,7 @@
30#include <ctype.h> 29#include <ctype.h>
31#include <string.h> 30#include <string.h>
32#include <unistd.h> 31#include <unistd.h>
32#include "busybox.h"
33 33
34static const int KILL = 0; 34static const int KILL = 0;
35static const int KILLALL = 1; 35static const int KILLALL = 1;
diff --git a/procps/ps.c b/procps/ps.c
index dd154af9d..4ce43c47f 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -28,7 +28,6 @@
28 * 28 *
29 */ 29 */
30 30
31#include "busybox.h"
32#include <stdio.h> 31#include <stdio.h>
33#include <stdlib.h> 32#include <stdlib.h>
34#include <unistd.h> 33#include <unistd.h>
@@ -38,6 +37,7 @@
38#include <ctype.h> 37#include <ctype.h>
39#include <string.h> 38#include <string.h>
40#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include "busybox.h"
41#define BB_DECLARE_EXTERN 41#define BB_DECLARE_EXTERN
42#define bb_need_help 42#define bb_need_help
43#include "messages.c" 43#include "messages.c"
diff --git a/procps/renice.c b/procps/renice.c
index 9180ebf81..ec35bdcde 100644
--- a/procps/renice.c
+++ b/procps/renice.c
@@ -20,12 +20,12 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <errno.h> 24#include <errno.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <sys/time.h> 26#include <sys/time.h>
28#include <sys/resource.h> 27#include <sys/resource.h>
28#include "busybox.h"
29 29
30 30
31extern int renice_main(int argc, char **argv) 31extern int renice_main(int argc, char **argv)
diff --git a/procps/uptime.c b/procps/uptime.c
index 213a39851..64df194f4 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
@@ -28,11 +28,11 @@
28 */ 28 */
29 29
30 30
31#include "busybox.h"
32#include <stdio.h> 31#include <stdio.h>
33#include <time.h> 32#include <time.h>
34#include <errno.h> 33#include <errno.h>
35#include <stdlib.h> 34#include <stdlib.h>
35#include "busybox.h"
36 36
37static const int FSHIFT = 16; /* nr of bits of precision */ 37static const int FSHIFT = 16; /* nr of bits of precision */
38#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ 38#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
diff --git a/ps.c b/ps.c
index dd154af9d..4ce43c47f 100644
--- a/ps.c
+++ b/ps.c
@@ -28,7 +28,6 @@
28 * 28 *
29 */ 29 */
30 30
31#include "busybox.h"
32#include <stdio.h> 31#include <stdio.h>
33#include <stdlib.h> 32#include <stdlib.h>
34#include <unistd.h> 33#include <unistd.h>
@@ -38,6 +37,7 @@
38#include <ctype.h> 37#include <ctype.h>
39#include <string.h> 38#include <string.h>
40#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include "busybox.h"
41#define BB_DECLARE_EXTERN 41#define BB_DECLARE_EXTERN
42#define bb_need_help 42#define bb_need_help
43#include "messages.c" 43#include "messages.c"
diff --git a/pwd.c b/pwd.c
index a9acbc721..a7a5f78a1 100644
--- a/pwd.c
+++ b/pwd.c
@@ -21,12 +21,12 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <dirent.h> 25#include <dirent.h>
27#include <errno.h> 26#include <errno.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31extern int pwd_main(int argc, char **argv) 31extern int pwd_main(int argc, char **argv)
32{ 32{
diff --git a/rdate.c b/rdate.c
index 38a7689e9..a3ea3a85b 100644
--- a/rdate.c
+++ b/rdate.c
@@ -21,9 +21,6 @@
21 * 21 *
22*/ 22*/
23 23
24#include "busybox.h"
25#define BB_DECLARE_EXTERN
26#include "messages.c"
27#include <sys/time.h> 24#include <sys/time.h>
28#include <sys/types.h> 25#include <sys/types.h>
29#include <sys/socket.h> 26#include <sys/socket.h>
@@ -33,6 +30,9 @@
33#include <getopt.h> 30#include <getopt.h>
34#include <stdlib.h> 31#include <stdlib.h>
35#include <unistd.h> 32#include <unistd.h>
33#include "busybox.h"
34#define BB_DECLARE_EXTERN
35#include "messages.c"
36 36
37 37
38static const int RFC_868_BIAS = 2208988800UL; 38static const int RFC_868_BIAS = 2208988800UL;
diff --git a/readlink.c b/readlink.c
index c82f64027..74196e11d 100644
--- a/readlink.c
+++ b/readlink.c
@@ -22,10 +22,10 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <errno.h> 25#include <errno.h>
27#include <unistd.h> 26#include <unistd.h>
28#include <stdlib.h> 27#include <stdlib.h>
28#include "busybox.h"
29 29
30int readlink_main(int argc, char **argv) 30int readlink_main(int argc, char **argv)
31{ 31{
diff --git a/renice.c b/renice.c
index 9180ebf81..ec35bdcde 100644
--- a/renice.c
+++ b/renice.c
@@ -20,12 +20,12 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <errno.h> 24#include <errno.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <sys/time.h> 26#include <sys/time.h>
28#include <sys/resource.h> 27#include <sys/resource.h>
28#include "busybox.h"
29 29
30 30
31extern int renice_main(int argc, char **argv) 31extern int renice_main(int argc, char **argv)
diff --git a/reset.c b/reset.c
index 294cab3c4..755c4c335 100644
--- a/reset.c
+++ b/reset.c
@@ -23,9 +23,9 @@
23 * 23 *
24 */ 24 */
25 25
26#include "busybox.h"
27#include <stdio.h> 26#include <stdio.h>
28#include <stdlib.h> 27#include <stdlib.h>
28#include "busybox.h"
29 29
30extern int reset_main(int argc, char **argv) 30extern int reset_main(int argc, char **argv)
31{ 31{
diff --git a/rm.c b/rm.c
index 566076707..a84163272 100644
--- a/rm.c
+++ b/rm.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <time.h> 26#include <time.h>
28#include <utime.h> 27#include <utime.h>
@@ -30,6 +29,7 @@
30#include <errno.h> 29#include <errno.h>
31#include <unistd.h> 30#include <unistd.h>
32#include <stdlib.h> 31#include <stdlib.h>
32#include "busybox.h"
33 33
34static int recursiveFlag = FALSE; 34static int recursiveFlag = FALSE;
35static int forceFlag = FALSE; 35static int forceFlag = FALSE;
diff --git a/rmdir.c b/rmdir.c
index 6266ce1ef..2c280376f 100644
--- a/rmdir.c
+++ b/rmdir.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <errno.h> 26#include <errno.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <stdlib.h> 28#include <stdlib.h>
29#include "busybox.h"
30 30
31extern int rmdir_main(int argc, char **argv) 31extern int rmdir_main(int argc, char **argv)
32{ 32{
diff --git a/rmmod.c b/rmmod.c
index 7d4538e6e..aab326123 100644
--- a/rmmod.c
+++ b/rmmod.c
@@ -21,13 +21,13 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <errno.h> 25#include <errno.h>
27#include <unistd.h> 26#include <unistd.h>
28#include <stdlib.h> 27#include <stdlib.h>
29#include <sys/syscall.h> 28#include <sys/syscall.h>
30#include <linux/unistd.h> 29#include <linux/unistd.h>
30#include "busybox.h"
31#define __LIBRARY__ 31#define __LIBRARY__
32 32
33 33
diff --git a/route.c b/route.c
index d98d9a0b6..9be002792 100644
--- a/route.c
+++ b/route.c
@@ -15,14 +15,13 @@
15 * Foundation; either version 2 of the License, or (at 15 * Foundation; either version 2 of the License, or (at
16 * your option) any later version. 16 * your option) any later version.
17 * 17 *
18 * $Id: route.c,v 1.6 2001/02/18 20:12:25 andersen Exp $ 18 * $Id: route.c,v 1.7 2001/02/20 06:14:08 andersen Exp $
19 * 19 *
20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> 20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
21 * busybox style adjustments by Larry Doolittle <LRDoolittle@lbl.gov> 21 * busybox style adjustments by Larry Doolittle <LRDoolittle@lbl.gov>
22 * displayroute() format now matches net-tools-1.57/lib/inet_gr.c line 173. 22 * displayroute() format now matches net-tools-1.57/lib/inet_gr.c line 173.
23 */ 23 */
24 24
25#include "busybox.h"
26#include <sys/types.h> 25#include <sys/types.h>
27#include <sys/ioctl.h> 26#include <sys/ioctl.h>
28#include <sys/socket.h> 27#include <sys/socket.h>
@@ -38,6 +37,7 @@
38#include <getopt.h> 37#include <getopt.h>
39#include <unistd.h> 38#include <unistd.h>
40#include <ctype.h> 39#include <ctype.h>
40#include "busybox.h"
41 41
42#define _(x) x 42#define _(x) x
43 43
diff --git a/rpmunpack.c b/rpmunpack.c
index 79971faf3..12e9c71de 100644
--- a/rpmunpack.c
+++ b/rpmunpack.c
@@ -13,11 +13,11 @@
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 */ 14 */
15 15
16#include "busybox.h"
17#include <fcntl.h> 16#include <fcntl.h>
18#include <unistd.h> 17#include <unistd.h>
19#include <string.h> 18#include <string.h>
20#include <stdlib.h> 19#include <stdlib.h>
20#include "busybox.h"
21 21
22/* 22/*
23 * Some general definitions 23 * Some general definitions
diff --git a/setkeycodes.c b/setkeycodes.c
index 0be4724ca..c3c7e09aa 100644
--- a/setkeycodes.c
+++ b/setkeycodes.c
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
28#include <fcntl.h> 27#include <fcntl.h>
29#include <sys/ioctl.h> 28#include <sys/ioctl.h>
29#include "busybox.h"
30 30
31 31
32/* From <linux/kd.h> */ 32/* From <linux/kd.h> */
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 97ba8316d..9cb53522f 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -32,6 +32,21 @@
32 32
33//#define TEST 33//#define TEST
34 34
35#include <stdio.h>
36#include <errno.h>
37#include <unistd.h>
38#include <stdlib.h>
39#include <string.h>
40#include <sys/ioctl.h>
41#include <ctype.h>
42#include <signal.h>
43#include <limits.h>
44
45#ifdef BB_FEATURE_SH_TAB_COMPLETION
46#include <dirent.h>
47#include <sys/stat.h>
48#endif
49
35 50
36#ifndef TEST 51#ifndef TEST
37 52
@@ -62,21 +77,6 @@
62#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR 77#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR
63#endif 78#endif
64 79
65#include <stdio.h>
66#include <errno.h>
67#include <unistd.h>
68#include <stdlib.h>
69#include <string.h>
70#include <sys/ioctl.h>
71#include <ctype.h>
72#include <signal.h>
73#include <limits.h>
74
75#ifdef BB_FEATURE_SH_TAB_COMPLETION
76#include <dirent.h>
77#include <sys/stat.h>
78#endif
79
80#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 80#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR
81#ifndef TEST 81#ifndef TEST
82#include "pwd_grp/pwd.h" 82#include "pwd_grp/pwd.h"
diff --git a/sleep.c b/sleep.c
index d21af19b3..3bcab88ee 100644
--- a/sleep.c
+++ b/sleep.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <unistd.h> 25#include <unistd.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int sleep_main(int argc, char **argv) 29extern int sleep_main(int argc, char **argv)
30{ 30{
diff --git a/sort.c b/sort.c
index 4984f5dfe..ed6872218 100644
--- a/sort.c
+++ b/sort.c
@@ -21,9 +21,9 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <getopt.h> 24#include <getopt.h>
26#include <stdlib.h> 25#include <stdlib.h>
26#include "busybox.h"
27 27
28int compare_ascii(const void *x, const void *y) 28int compare_ascii(const void *x, const void *y)
29{ 29{
diff --git a/stty.c b/stty.c
index 4a5aecf1d..10e28254d 100644
--- a/stty.c
+++ b/stty.c
@@ -28,7 +28,6 @@
28 28
29 */ 29 */
30 30
31#include "busybox.h"
32 31
33#include <termios.h> 32#include <termios.h>
34#include <sys/ioctl.h> 33#include <sys/ioctl.h>
@@ -53,6 +52,7 @@
53#include <limits.h> 52#include <limits.h>
54#include <memory.h> 53#include <memory.h>
55#include <fcntl.h> 54#include <fcntl.h>
55#include "busybox.h"
56 56
57#define STREQ(a, b) (strcmp ((a), (b)) == 0) 57#define STREQ(a, b) (strcmp ((a), (b)) == 0)
58 58
diff --git a/swaponoff.c b/swaponoff.c
index 8dda0972a..0613fa1e9 100644
--- a/swaponoff.c
+++ b/swaponoff.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <mntent.h> 26#include <mntent.h>
28#include <dirent.h> 27#include <dirent.h>
@@ -31,6 +30,7 @@
31#include <sys/mount.h> 30#include <sys/mount.h>
32#include <sys/syscall.h> 31#include <sys/syscall.h>
33#include <linux/unistd.h> 32#include <linux/unistd.h>
33#include "busybox.h"
34 34
35_syscall2(int, swapon, const char *, path, int, flags); 35_syscall2(int, swapon, const char *, path, int, flags);
36_syscall1(int, swapoff, const char *, path); 36_syscall1(int, swapoff, const char *, path);
diff --git a/sync.c b/sync.c
index 3d4686efa..ee22ae109 100644
--- a/sync.c
+++ b/sync.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <unistd.h> 26#include <unistd.h>
27#include "busybox.h"
28 28
29extern int sync_main(int argc, char **argv) 29extern int sync_main(int argc, char **argv)
30{ 30{
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index 352bde158..1218d8d2e 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <unistd.h> 25#include <unistd.h>
27#include <sys/types.h> 26#include <sys/types.h>
@@ -30,6 +29,7 @@
30#include <string.h> 29#include <string.h>
31#include <stdlib.h> 30#include <stdlib.h>
32 31
32#include "busybox.h"
33#if !defined BB_SYSLOGD 33#if !defined BB_SYSLOGD
34 34
35#define SYSLOG_NAMES 35#define SYSLOG_NAMES
@@ -40,6 +40,7 @@
40 * structures. Argh.... bad libc, bad, bad... 40 * structures. Argh.... bad libc, bad, bad...
41 */ 41 */
42#include <sys/syslog.h> 42#include <sys/syslog.h>
43
43typedef struct _code { 44typedef struct _code {
44 char *c_name; 45 char *c_name;
45 int c_val; 46 int c_val;
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 872728b5b..8049fc5d1 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -23,7 +23,6 @@
23 * 23 *
24 */ 24 */
25 25
26#include "busybox.h"
27#include <stdio.h> 26#include <stdio.h>
28#include <stdlib.h> 27#include <stdlib.h>
29#include <ctype.h> 28#include <ctype.h>
@@ -56,6 +55,7 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
56#else 55#else
57# include <sys/klog.h> 56# include <sys/klog.h>
58#endif 57#endif
58#include "busybox.h"
59 59
60 60
61 61
diff --git a/syslogd.c b/syslogd.c
index 872728b5b..8049fc5d1 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -23,7 +23,6 @@
23 * 23 *
24 */ 24 */
25 25
26#include "busybox.h"
27#include <stdio.h> 26#include <stdio.h>
28#include <stdlib.h> 27#include <stdlib.h>
29#include <ctype.h> 28#include <ctype.h>
@@ -56,6 +55,7 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
56#else 55#else
57# include <sys/klog.h> 56# include <sys/klog.h>
58#endif 57#endif
58#include "busybox.h"
59 59
60 60
61 61
diff --git a/tail.c b/tail.c
index 778c2d18b..a85256c80 100644
--- a/tail.c
+++ b/tail.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25 24
26#include <fcntl.h> 25#include <fcntl.h>
27#include <getopt.h> 26#include <getopt.h>
@@ -29,6 +28,7 @@
29#include <stdlib.h> 28#include <stdlib.h>
30#include <unistd.h> 29#include <unistd.h>
31#include <sys/types.h> 30#include <sys/types.h>
31#include "busybox.h"
32 32
33static const struct suffix_mult tail_suffixes[] = { 33static const struct suffix_mult tail_suffixes[] = {
34 { "b", 512 }, 34 { "b", 512 },
diff --git a/tar.c b/tar.c
index 62f1b1d35..a9363d5ad 100644
--- a/tar.c
+++ b/tar.c
@@ -36,11 +36,6 @@
36 */ 36 */
37 37
38 38
39#include "busybox.h"
40#define BB_DECLARE_EXTERN
41#define bb_need_io_error
42#define bb_need_name_longer_than_foo
43#include "messages.c"
44#include <stdio.h> 39#include <stdio.h>
45#include <dirent.h> 40#include <dirent.h>
46#include <errno.h> 41#include <errno.h>
@@ -55,6 +50,11 @@
55#include <string.h> 50#include <string.h>
56#include <stdlib.h> 51#include <stdlib.h>
57#include <unistd.h> 52#include <unistd.h>
53#include "busybox.h"
54#define BB_DECLARE_EXTERN
55#define bb_need_io_error
56#define bb_need_name_longer_than_foo
57#include "messages.c"
58 58
59#ifdef BB_FEATURE_TAR_GZIP 59#ifdef BB_FEATURE_TAR_GZIP
60extern int unzip(int in, int out); 60extern int unzip(int in, int out);
diff --git a/telnet.c b/telnet.c
index ed92a8403..fd1ace41d 100644
--- a/telnet.c
+++ b/telnet.c
@@ -30,7 +30,6 @@
30 * 30 *
31 */ 31 */
32 32
33#include "busybox.h"
34#include <termios.h> 33#include <termios.h>
35#include <unistd.h> 34#include <unistd.h>
36#include <errno.h> 35#include <errno.h>
@@ -43,6 +42,7 @@
43#include <sys/socket.h> 42#include <sys/socket.h>
44#include <netinet/in.h> 43#include <netinet/in.h>
45#include <netdb.h> 44#include <netdb.h>
45#include "busybox.h"
46 46
47#if 0 47#if 0
48static const int DOTRACE = 1; 48static const int DOTRACE = 1;
diff --git a/test.c b/test.c
index 6439e3a8a..ab9c23e4b 100644
--- a/test.c
+++ b/test.c
@@ -31,13 +31,13 @@
31 * "This program is in the Public Domain." 31 * "This program is in the Public Domain."
32 */ 32 */
33 33
34#include "busybox.h"
35#include <sys/types.h> 34#include <sys/types.h>
36#include <unistd.h> 35#include <unistd.h>
37#include <ctype.h> 36#include <ctype.h>
38#include <errno.h> 37#include <errno.h>
39#include <stdlib.h> 38#include <stdlib.h>
40#include <string.h> 39#include <string.h>
40#include "busybox.h"
41#define BB_DECLARE_EXTERN 41#define BB_DECLARE_EXTERN
42#define bb_need_help 42#define bb_need_help
43#include "messages.c" 43#include "messages.c"
diff --git a/touch.c b/touch.c
index a3256d559..1718da71e 100644
--- a/touch.c
+++ b/touch.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <sys/types.h> 26#include <sys/types.h>
28#include <fcntl.h> 27#include <fcntl.h>
@@ -30,6 +29,7 @@
30#include <errno.h> 29#include <errno.h>
31#include <unistd.h> 30#include <unistd.h>
32#include <stdlib.h> 31#include <stdlib.h>
32#include "busybox.h"
33 33
34extern int touch_main(int argc, char **argv) 34extern int touch_main(int argc, char **argv)
35{ 35{
diff --git a/tr.c b/tr.c
index 92f399e14..b7a6009c8 100644
--- a/tr.c
+++ b/tr.c
@@ -24,12 +24,12 @@
24 * Original copyright notice is retained at the end of this file. 24 * Original copyright notice is retained at the end of this file.
25 */ 25 */
26 26
27#include "busybox.h"
28#include <stdio.h> 27#include <stdio.h>
29#include <string.h> 28#include <string.h>
30#include <stdlib.h> 29#include <stdlib.h>
31#include <unistd.h> 30#include <unistd.h>
32#include <sys/types.h> 31#include <sys/types.h>
32#include "busybox.h"
33#define BB_DECLARE_EXTERN 33#define BB_DECLARE_EXTERN
34#define bb_need_write_error 34#define bb_need_write_error
35#include "messages.c" 35#include "messages.c"
diff --git a/true_false.c b/true_false.c
index 187f68072..47d3bb1e4 100644
--- a/true_false.c
+++ b/true_false.c
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdlib.h> 25#include <stdlib.h>
26#include "busybox.h"
27 27
28 28
29extern int true_main(int argc, char **argv) 29extern int true_main(int argc, char **argv)
diff --git a/tty.c b/tty.c
index d71d8dedb..4510c2996 100644
--- a/tty.c
+++ b/tty.c
@@ -20,11 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
27#include <sys/types.h> 26#include <sys/types.h>
27#include "busybox.h"
28 28
29extern int tty_main(int argc, char **argv) 29extern int tty_main(int argc, char **argv)
30{ 30{
diff --git a/umount.c b/umount.c
index c160ec284..2868a1bc3 100644
--- a/umount.c
+++ b/umount.c
@@ -22,12 +22,12 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <mntent.h> 26#include <mntent.h>
28#include <errno.h> 27#include <errno.h>
29#include <string.h> 28#include <string.h>
30#include <stdlib.h> 29#include <stdlib.h>
30#include "busybox.h"
31 31
32 32
33static const int MNT_FORCE = 1; 33static const int MNT_FORCE = 1;
diff --git a/uname.c b/uname.c
index 899da7792..4931ff1d8 100644
--- a/uname.c
+++ b/uname.c
@@ -31,7 +31,6 @@
31 31
32/* Busyboxed by Erik Andersen */ 32/* Busyboxed by Erik Andersen */
33 33
34#include "busybox.h"
35#include <stdio.h> 34#include <stdio.h>
36#include <stdlib.h> 35#include <stdlib.h>
37#include <sys/types.h> 36#include <sys/types.h>
@@ -40,6 +39,7 @@
40#if defined (HAVE_SYSINFO) && defined (HAVE_SYS_SYSTEMINFO_H) 39#if defined (HAVE_SYSINFO) && defined (HAVE_SYS_SYSTEMINFO_H)
41# include <sys/systeminfo.h> 40# include <sys/systeminfo.h>
42#endif 41#endif
42#include "busybox.h"
43 43
44static void print_element(unsigned int mask, char *element); 44static void print_element(unsigned int mask, char *element);
45 45
diff --git a/uniq.c b/uniq.c
index 84f1ed231..53e3c64f2 100644
--- a/uniq.c
+++ b/uniq.c
@@ -23,12 +23,12 @@
23 * 23 *
24 */ 24 */
25 25
26#include "busybox.h"
27#include <stdio.h> 26#include <stdio.h>
28#include <string.h> 27#include <string.h>
29#include <getopt.h> 28#include <getopt.h>
30#include <errno.h> 29#include <errno.h>
31#include <stdlib.h> 30#include <stdlib.h>
31#include "busybox.h"
32 32
33static int print_count; 33static int print_count;
34static int print_uniq = 1; 34static int print_uniq = 1;
diff --git a/update.c b/update.c
index 2cf4a98b2..b282b9e18 100644
--- a/update.c
+++ b/update.c
@@ -28,7 +28,6 @@
28 * earlier) kernel. 2.2.x and higher flush filesystem buffers automatically. 28 * earlier) kernel. 2.2.x and higher flush filesystem buffers automatically.
29 */ 29 */
30 30
31#include "busybox.h"
32#include <sys/param.h> 31#include <sys/param.h>
33#include <sys/syslog.h> 32#include <sys/syslog.h>
34#include <unistd.h> /* for getopt() */ 33#include <unistd.h> /* for getopt() */
@@ -42,6 +41,7 @@
42#include <linux/unistd.h> 41#include <linux/unistd.h>
43static _syscall2(int, bdflush, int, func, int, data); 42static _syscall2(int, bdflush, int, func, int, data);
44#endif /* __GLIBC__ */ 43#endif /* __GLIBC__ */
44#include "busybox.h"
45 45
46static unsigned int sync_duration = 30; 46static unsigned int sync_duration = 30;
47static unsigned int flush_duration = 5; 47static unsigned int flush_duration = 5;
diff --git a/uptime.c b/uptime.c
index 213a39851..64df194f4 100644
--- a/uptime.c
+++ b/uptime.c
@@ -28,11 +28,11 @@
28 */ 28 */
29 29
30 30
31#include "busybox.h"
32#include <stdio.h> 31#include <stdio.h>
33#include <time.h> 32#include <time.h>
34#include <errno.h> 33#include <errno.h>
35#include <stdlib.h> 34#include <stdlib.h>
35#include "busybox.h"
36 36
37static const int FSHIFT = 16; /* nr of bits of precision */ 37static const int FSHIFT = 16; /* nr of bits of precision */
38#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ 38#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
diff --git a/usleep.c b/usleep.c
index c67c365b8..92e4437c5 100644
--- a/usleep.c
+++ b/usleep.c
@@ -21,9 +21,9 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
26#include "busybox.h"
27 27
28extern int usleep_main(int argc, char **argv) 28extern int usleep_main(int argc, char **argv)
29{ 29{
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 47f9f4474..2c85ed3e9 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -15,7 +15,6 @@
15 * Support, replaced getopt, added some gotos for redundant stuff. 15 * Support, replaced getopt, added some gotos for redundant stuff.
16 */ 16 */
17 17
18#include "busybox.h"
19#include <stdio.h> 18#include <stdio.h>
20#include <stdlib.h> 19#include <stdlib.h>
21#include <getopt.h> 20#include <getopt.h>
@@ -33,6 +32,7 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
33#else 32#else
34# include <sys/klog.h> 33# include <sys/klog.h>
35#endif 34#endif
35#include "busybox.h"
36 36
37int dmesg_main(int argc, char **argv) 37int dmesg_main(int argc, char **argv)
38{ 38{
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 9acabbecb..72284a6c5 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -24,7 +24,6 @@
24 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) 24 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
25 */ 25 */
26 26
27#include "busybox.h"
28#include <stdio.h> 27#include <stdio.h>
29#include <stdlib.h> 28#include <stdlib.h>
30#include <unistd.h> 29#include <unistd.h>
@@ -33,6 +32,7 @@
33#include <ctype.h> 32#include <ctype.h>
34#include <string.h> 33#include <string.h>
35#include <sys/ioctl.h> 34#include <sys/ioctl.h>
35#include "busybox.h"
36 36
37#define DEFAULTFBDEV "/dev/fb0" 37#define DEFAULTFBDEV "/dev/fb0"
38#define DEFAULTFBMODE "/etc/fb.modes" 38#define DEFAULTFBMODE "/etc/fb.modes"
diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c
index f10cceae0..28f5cb68a 100644
--- a/util-linux/fdflush.c
+++ b/util-linux/fdflush.c
@@ -21,11 +21,11 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <sys/ioctl.h> 25#include <sys/ioctl.h>
27#include <fcntl.h> 26#include <fcntl.h>
28#include <stdlib.h> 27#include <stdlib.h>
28#include "busybox.h"
29 29
30/* From <linux/fd.h> */ 30/* From <linux/fd.h> */
31#define FDFLUSH _IO(2,0x4b) 31#define FDFLUSH _IO(2,0x4b)
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 2b4c65144..9a53a705e 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -86,7 +86,6 @@
86 * enforced (but it's not much fun on a character device :-). 86 * enforced (but it's not much fun on a character device :-).
87 */ 87 */
88 88
89#include "busybox.h"
90#include <stdio.h> 89#include <stdio.h>
91#include <errno.h> 90#include <errno.h>
92#include <unistd.h> 91#include <unistd.h>
@@ -97,6 +96,7 @@
97#include <termios.h> 96#include <termios.h>
98#include <mntent.h> 97#include <mntent.h>
99#include <sys/param.h> 98#include <sys/param.h>
99#include "busybox.h"
100 100
101 101
102 typedef unsigned char u8; 102 typedef unsigned char u8;
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 6b4a3e2d1..b666338dc 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -62,7 +62,6 @@
62 * removed getopt based parser and added a hand rolled one. 62 * removed getopt based parser and added a hand rolled one.
63 */ 63 */
64 64
65#include "busybox.h"
66#include <stdio.h> 65#include <stdio.h>
67#include <time.h> 66#include <time.h>
68#include <unistd.h> 67#include <unistd.h>
@@ -75,6 +74,7 @@
75#include <sys/ioctl.h> 74#include <sys/ioctl.h>
76#include <sys/param.h> 75#include <sys/param.h>
77#include <mntent.h> 76#include <mntent.h>
77#include "busybox.h"
78 78
79 79
80typedef unsigned char u8; 80typedef unsigned char u8;
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 48637e889..b5153f623 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -35,7 +35,6 @@
35 * 35 *
36 */ 36 */
37 37
38#include "busybox.h"
39#include <stdio.h> 38#include <stdio.h>
40#include <unistd.h> 39#include <unistd.h>
41#include <string.h> 40#include <string.h>
@@ -45,6 +44,7 @@
45#include <sys/utsname.h> 44#include <sys/utsname.h>
46#include <asm/page.h> /* for PAGE_SIZE and PAGE_SHIFT */ 45#include <asm/page.h> /* for PAGE_SIZE and PAGE_SHIFT */
47 /* we also get PAGE_SIZE via getpagesize() */ 46 /* we also get PAGE_SIZE via getpagesize() */
47#include "busybox.h"
48 48
49#ifndef _IO 49#ifndef _IO
50/* pre-1.3.45 */ 50/* pre-1.3.45 */
diff --git a/util-linux/more.c b/util-linux/more.c
index c4c74fe4a..298e1cfb1 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -25,12 +25,12 @@
25 * 25 *
26 */ 26 */
27 27
28#include "busybox.h"
29#include <stdio.h> 28#include <stdio.h>
30#include <fcntl.h> 29#include <fcntl.h>
31#include <signal.h> 30#include <signal.h>
32#include <stdlib.h> 31#include <stdlib.h>
33#include <sys/ioctl.h> 32#include <sys/ioctl.h>
33#include "busybox.h"
34#define BB_DECLARE_EXTERN 34#define BB_DECLARE_EXTERN
35#define bb_need_help 35#define bb_need_help
36#include "messages.c" 36#include "messages.c"
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 2f5bba59d..7b0bf3e21 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -43,7 +43,6 @@
43 * 43 *
44 */ 44 */
45 45
46#include "busybox.h"
47#include <stdlib.h> 46#include <stdlib.h>
48#include <unistd.h> 47#include <unistd.h>
49#include <errno.h> 48#include <errno.h>
@@ -54,6 +53,7 @@
54#if defined BB_FEATURE_USE_DEVPS_PATCH 53#if defined BB_FEATURE_USE_DEVPS_PATCH
55#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */ 54#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */
56#endif 55#endif
56#include "busybox.h"
57 57
58enum { 58enum {
59 MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */ 59 MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index ae44f3207..aee496980 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -33,25 +33,25 @@
33 * nfsmount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp 33 * nfsmount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp
34 */ 34 */
35 35
36#include "busybox.h"
37#undef FALSE
38#undef TRUE
39#include <unistd.h> 36#include <unistd.h>
40#include <stdio.h> 37#include <stdio.h>
41#include <string.h> 38#include <string.h>
42#include <errno.h> 39#include <errno.h>
43#include <netdb.h> 40#include <netdb.h>
44#include <rpc/rpc.h>
45#include <rpc/pmap_prot.h>
46#include <rpc/pmap_clnt.h>
47#include <sys/socket.h> 41#include <sys/socket.h>
48#include <time.h> 42#include <time.h>
49#include <sys/utsname.h> 43#include <sys/utsname.h>
50#include <netinet/in.h> 44#include <netinet/in.h>
51#include <arpa/inet.h> 45#include <arpa/inet.h>
52 46#include <stdlib.h>
53#include "nfsmount.h" 47#include "busybox.h"
48#undef TRUE
49#undef FALSE
50#include <rpc/rpc.h>
51#include <rpc/pmap_prot.h>
52#include <rpc/pmap_clnt.h>
54#include <linux/nfs.h> /* For the kernels nfs stuff */ 53#include <linux/nfs.h> /* For the kernels nfs stuff */
54#include "nfsmount.h"
55 55
56#ifndef NFS_FHSIZE 56#ifndef NFS_FHSIZE
57static const int NFS_FHSIZE = 32; 57static const int NFS_FHSIZE = 32;
diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c
index e00710148..d7b80d749 100644
--- a/util-linux/pivot_root.c
+++ b/util-linux/pivot_root.c
@@ -4,11 +4,11 @@
4 * 4 *
5 * busyboxed by Evin Robertson 5 * busyboxed by Evin Robertson
6 */ 6 */
7#include "busybox.h"
8#include <stdlib.h> 7#include <stdlib.h>
9#include <stdio.h> 8#include <stdio.h>
10#include <sys/syscall.h> 9#include <sys/syscall.h>
11#include <linux/unistd.h> 10#include <linux/unistd.h>
11#include "busybox.h"
12 12
13#ifndef __NR_pivot_root 13#ifndef __NR_pivot_root
14#error Sorry, but this kernel does not support the pivot_root syscall 14#error Sorry, but this kernel does not support the pivot_root syscall
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 38a7689e9..a3ea3a85b 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -21,9 +21,6 @@
21 * 21 *
22*/ 22*/
23 23
24#include "busybox.h"
25#define BB_DECLARE_EXTERN
26#include "messages.c"
27#include <sys/time.h> 24#include <sys/time.h>
28#include <sys/types.h> 25#include <sys/types.h>
29#include <sys/socket.h> 26#include <sys/socket.h>
@@ -33,6 +30,9 @@
33#include <getopt.h> 30#include <getopt.h>
34#include <stdlib.h> 31#include <stdlib.h>
35#include <unistd.h> 32#include <unistd.h>
33#include "busybox.h"
34#define BB_DECLARE_EXTERN
35#include "messages.c"
36 36
37 37
38static const int RFC_868_BIAS = 2208988800UL; 38static const int RFC_868_BIAS = 2208988800UL;
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 8dda0972a..0613fa1e9 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <mntent.h> 26#include <mntent.h>
28#include <dirent.h> 27#include <dirent.h>
@@ -31,6 +30,7 @@
31#include <sys/mount.h> 30#include <sys/mount.h>
32#include <sys/syscall.h> 31#include <sys/syscall.h>
33#include <linux/unistd.h> 32#include <linux/unistd.h>
33#include "busybox.h"
34 34
35_syscall2(int, swapon, const char *, path, int, flags); 35_syscall2(int, swapon, const char *, path, int, flags);
36_syscall1(int, swapoff, const char *, path); 36_syscall1(int, swapoff, const char *, path);
diff --git a/util-linux/umount.c b/util-linux/umount.c
index c160ec284..2868a1bc3 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -22,12 +22,12 @@
22 * 22 *
23 */ 23 */
24 24
25#include "busybox.h"
26#include <stdio.h> 25#include <stdio.h>
27#include <mntent.h> 26#include <mntent.h>
28#include <errno.h> 27#include <errno.h>
29#include <string.h> 28#include <string.h>
30#include <stdlib.h> 29#include <stdlib.h>
30#include "busybox.h"
31 31
32 32
33static const int MNT_FORCE = 1; 33static const int MNT_FORCE = 1;
diff --git a/utility.c b/utility.c
index 65496b9f7..cf0aecc80 100644
--- a/utility.c
+++ b/utility.c
@@ -25,6 +25,20 @@
25 * 25 *
26 */ 26 */
27 27
28#include <stdio.h>
29#include <string.h>
30#include <errno.h>
31#include <fcntl.h>
32#include <dirent.h>
33#include <time.h>
34#include <utime.h>
35#include <unistd.h>
36#include <ctype.h>
37#include <stdlib.h>
38#include <limits.h>
39#include <sys/ioctl.h>
40#include <sys/utsname.h> /* for uname(2) */
41
28#include "busybox.h" 42#include "busybox.h"
29#if defined (BB_CHMOD_CHOWN_CHGRP) \ 43#if defined (BB_CHMOD_CHOWN_CHGRP) \
30 || defined (BB_CP_MV) \ 44 || defined (BB_CP_MV) \
@@ -42,20 +56,6 @@
42#include "messages.c" 56#include "messages.c"
43#include "usage.h" 57#include "usage.h"
44 58
45#include <stdio.h>
46#include <string.h>
47#include <errno.h>
48#include <fcntl.h>
49#include <dirent.h>
50#include <time.h>
51#include <utime.h>
52#include <unistd.h>
53#include <ctype.h>
54#include <stdlib.h>
55#include <limits.h>
56#include <sys/ioctl.h>
57#include <sys/utsname.h> /* for uname(2) */
58
59#include "pwd_grp/pwd.h" 59#include "pwd_grp/pwd.h"
60#include "pwd_grp/grp.h" 60#include "pwd_grp/grp.h"
61 61
diff --git a/uudecode.c b/uudecode.c
index c0e8cea8c..6a3f78a42 100644
--- a/uudecode.c
+++ b/uudecode.c
@@ -22,13 +22,13 @@
22 */ 22 */
23 23
24 24
25#include "busybox.h"
26 25
27#include <stdio.h> 26#include <stdio.h>
28#include <errno.h> 27#include <errno.h>
29#include <getopt.h> 28#include <getopt.h>
30#include <string.h> 29#include <string.h>
31#include <stdlib.h> 30#include <stdlib.h>
31#include "busybox.h"
32#include "pwd_grp/pwd.h" 32#include "pwd_grp/pwd.h"
33#include "pwd_grp/grp.h" 33#include "pwd_grp/grp.h"
34 34
diff --git a/uuencode.c b/uuencode.c
index 8d5af4a8a..41541defb 100644
--- a/uuencode.c
+++ b/uuencode.c
@@ -22,12 +22,12 @@
22/* Hacked to work with BusyBox by Alfred M. Szmidt */ 22/* Hacked to work with BusyBox by Alfred M. Szmidt */
23 23
24 24
25#include "busybox.h"
26 25
27#include <stdio.h> 26#include <stdio.h>
28#include <errno.h> 27#include <errno.h>
29#include <getopt.h> 28#include <getopt.h>
30#include <stdlib.h> 29#include <stdlib.h>
30#include "busybox.h"
31 31
32#define RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) 32#define RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
33 33
diff --git a/watchdog.c b/watchdog.c
index 65d0fc35f..5b5fd6953 100644
--- a/watchdog.c
+++ b/watchdog.c
@@ -20,11 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <fcntl.h> 24#include <fcntl.h>
26#include <unistd.h> 25#include <unistd.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int watchdog_main(int argc, char **argv) 29extern int watchdog_main(int argc, char **argv)
30{ 30{
diff --git a/wc.c b/wc.c
index f41687422..f2d33d6f3 100644
--- a/wc.c
+++ b/wc.c
@@ -20,10 +20,10 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <getopt.h> 24#include <getopt.h>
26#include <stdlib.h> 25#include <stdlib.h>
26#include "busybox.h"
27 27
28static int total_lines, total_words, total_chars, max_length; 28static int total_lines, total_words, total_chars, max_length;
29static int print_lines, print_words, print_chars, print_length; 29static int print_lines, print_words, print_chars, print_length;
diff --git a/wget.c b/wget.c
index d1aacefa6..4b8392ba5 100644
--- a/wget.c
+++ b/wget.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16 16
17#include "busybox.h"
18#include <stdio.h> 17#include <stdio.h>
19#include <errno.h> 18#include <errno.h>
20#include <stdlib.h> 19#include <stdlib.h>
@@ -33,6 +32,8 @@
33#include <arpa/inet.h> 32#include <arpa/inet.h>
34#include <netdb.h> 33#include <netdb.h>
35 34
35#include "busybox.h"
36
36/* Stupid libc5 doesn't define this... */ 37/* Stupid libc5 doesn't define this... */
37#ifndef timersub 38#ifndef timersub
38#define timersub(a, b, result) \ 39#define timersub(a, b, result) \
@@ -533,7 +534,7 @@ progressmeter(int flag)
533 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 534 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
534 * SUCH DAMAGE. 535 * SUCH DAMAGE.
535 * 536 *
536 * $Id: wget.c,v 1.27 2001/02/14 21:23:06 andersen Exp $ 537 * $Id: wget.c,v 1.28 2001/02/20 06:14:08 andersen Exp $
537 */ 538 */
538 539
539 540
diff --git a/which.c b/which.c
index 1908db30a..f9d51f2f3 100644
--- a/which.c
+++ b/which.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <string.h> 24#include <string.h>
26#include <stdio.h> 25#include <stdio.h>
27#include <stdlib.h> 26#include <stdlib.h>
27#include "busybox.h"
28 28
29extern int which_main(int argc, char **argv) 29extern int which_main(int argc, char **argv)
30{ 30{
diff --git a/whoami.c b/whoami.c
index 54df0bf12..0bbb54b7b 100644
--- a/whoami.c
+++ b/whoami.c
@@ -20,10 +20,10 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include <unistd.h> 25#include <unistd.h>
26#include "busybox.h"
27 27
28extern int whoami_main(int argc, char **argv) 28extern int whoami_main(int argc, char **argv)
29{ 29{
diff --git a/xargs.c b/xargs.c
index f05efd917..01aa5be69 100644
--- a/xargs.c
+++ b/xargs.c
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#include "busybox.h"
25#include <stdio.h> 24#include <stdio.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <string.h> 26#include <string.h>
27#include "busybox.h"
28 28
29int xargs_main(int argc, char **argv) 29int xargs_main(int argc, char **argv)
30{ 30{
diff --git a/yes.c b/yes.c
index 0a8ad83a7..ad7b98f84 100644
--- a/yes.c
+++ b/yes.c
@@ -20,9 +20,9 @@
20 * 20 *
21 */ 21 */
22 22
23#include "busybox.h"
24#include <stdio.h> 23#include <stdio.h>
25#include <stdlib.h> 24#include <stdlib.h>
25#include "busybox.h"
26 26
27extern int yes_main(int argc, char **argv) 27extern int yes_main(int argc, char **argv)
28{ 28{