aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-17 20:29:00 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-17 20:29:00 +0000
commita7189f01a4a19a9c8852e84b322fc3d8cbda92eb (patch)
tree436e3ab7b6f055553199153e99f6b7589fb488ec
parent04c6386c45cd795617dd754066ac3bd6a62757cb (diff)
downloadbusybox-w32-a7189f01a4a19a9c8852e84b322fc3d8cbda92eb.tar.gz
busybox-w32-a7189f01a4a19a9c8852e84b322fc3d8cbda92eb.tar.bz2
busybox-w32-a7189f01a4a19a9c8852e84b322fc3d8cbda92eb.zip
add -Wundef, fix uncovered bugs
-rw-r--r--Makefile.flags2
-rw-r--r--e2fsprogs/blkid/blkid_getsize.c2
-rw-r--r--e2fsprogs/blkid/devname.c8
-rw-r--r--e2fsprogs/blkid/devno.c8
-rw-r--r--e2fsprogs/blkid/resolve.c2
-rw-r--r--e2fsprogs/e2fsck.c2
-rw-r--r--e2fsprogs/e2p/fgetsetflags.c8
-rw-r--r--e2fsprogs/e2p/fgetsetversion.c6
-rw-r--r--e2fsprogs/ext2fs/finddev.c10
-rw-r--r--include/platform.h2
-rw-r--r--networking/ifconfig.c2
-rw-r--r--networking/interface.c2
-rw-r--r--networking/libiproute/ll_proto.c2
-rw-r--r--networking/udhcp/clientpacket.c2
-rw-r--r--networking/udhcp/clientsocket.c2
-rw-r--r--networking/udhcp/packet.c2
-rw-r--r--networking/udhcp/socket.c2
-rw-r--r--procps/renice.c26
-rw-r--r--shell/ash.c55
19 files changed, 71 insertions, 74 deletions
diff --git a/Makefile.flags b/Makefile.flags
index 12c5d58dd..ed42c2b6d 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -11,7 +11,7 @@ CPPFLAGS += \
11 -D_GNU_SOURCE -DNDEBUG \ 11 -D_GNU_SOURCE -DNDEBUG \
12 $(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \ 12 $(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \
13 -D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP \ 13 -D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP \
14 -Wall -Wstrict-prototypes -Wshadow -Werror \ 14 -Wall -Wstrict-prototypes -Wshadow -Werror -Wundef \
15 -funsigned-char -fno-builtin-strlen -finline-limit=0 -static-libgcc \ 15 -funsigned-char -fno-builtin-strlen -finline-limit=0 -static-libgcc \
16 -Os -falign-functions=1 -falign-jumps=1 -falign-loops=1 \ 16 -Os -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
17 -fomit-frame-pointer -ffunction-sections -fdata-sections 17 -fomit-frame-pointer -ffunction-sections -fdata-sections
diff --git a/e2fsprogs/blkid/blkid_getsize.c b/e2fsprogs/blkid/blkid_getsize.c
index 3c5ec5b76..941efa42c 100644
--- a/e2fsprogs/blkid/blkid_getsize.c
+++ b/e2fsprogs/blkid/blkid_getsize.c
@@ -15,7 +15,7 @@
15 15
16#include <stdio.h> 16#include <stdio.h>
17#include <unistd.h> 17#include <unistd.h>
18#if HAVE_ERRNO_H 18#ifdef HAVE_ERRNO_H
19#include <errno.h> 19#include <errno.h>
20#endif 20#endif
21#include <fcntl.h> 21#include <fcntl.h>
diff --git a/e2fsprogs/blkid/devname.c b/e2fsprogs/blkid/devname.c
index 7606e400d..532aeeaab 100644
--- a/e2fsprogs/blkid/devname.c
+++ b/e2fsprogs/blkid/devname.c
@@ -14,20 +14,20 @@
14 14
15#include <stdio.h> 15#include <stdio.h>
16#include <string.h> 16#include <string.h>
17#if HAVE_UNISTD_H 17#ifdef HAVE_UNISTD_H
18#include <unistd.h> 18#include <unistd.h>
19#endif 19#endif
20#include <stdlib.h> 20#include <stdlib.h>
21#include <string.h> 21#include <string.h>
22#include <ctype.h> 22#include <ctype.h>
23#if HAVE_SYS_TYPES_H 23#ifdef HAVE_SYS_TYPES_H
24#include <sys/types.h> 24#include <sys/types.h>
25#endif 25#endif
26#include <sys/stat.h> 26#include <sys/stat.h>
27#if HAVE_ERRNO_H 27#ifdef HAVE_ERRNO_H
28#include <errno.h> 28#include <errno.h>
29#endif 29#endif
30#if HAVE_SYS_MKDEV_H 30#ifdef HAVE_SYS_MKDEV_H
31#include <sys/mkdev.h> 31#include <sys/mkdev.h>
32#endif 32#endif
33#include <time.h> 33#include <time.h>
diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c
index 4f3dd93cd..13e7f1a87 100644
--- a/e2fsprogs/blkid/devno.c
+++ b/e2fsprogs/blkid/devno.c
@@ -13,20 +13,20 @@
13 13
14#include <stdio.h> 14#include <stdio.h>
15#include <string.h> 15#include <string.h>
16#if HAVE_UNISTD_H 16#ifdef HAVE_UNISTD_H
17#include <unistd.h> 17#include <unistd.h>
18#endif 18#endif
19#include <stdlib.h> 19#include <stdlib.h>
20#include <string.h> 20#include <string.h>
21#if HAVE_SYS_TYPES_H 21#ifdef HAVE_SYS_TYPES_H
22#include <sys/types.h> 22#include <sys/types.h>
23#endif 23#endif
24#include <sys/stat.h> 24#include <sys/stat.h>
25#include <dirent.h> 25#include <dirent.h>
26#if HAVE_ERRNO_H 26#ifdef HAVE_ERRNO_H
27#include <errno.h> 27#include <errno.h>
28#endif 28#endif
29#if HAVE_SYS_MKDEV_H 29#ifdef HAVE_SYS_MKDEV_H
30#include <sys/mkdev.h> 30#include <sys/mkdev.h>
31#endif 31#endif
32 32
diff --git a/e2fsprogs/blkid/resolve.c b/e2fsprogs/blkid/resolve.c
index c6f54a272..2bbcaf31d 100644
--- a/e2fsprogs/blkid/resolve.c
+++ b/e2fsprogs/blkid/resolve.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include <stdio.h> 14#include <stdio.h>
15#if HAVE_UNISTD_H 15#ifdef HAVE_UNISTD_H
16#include <unistd.h> 16#include <unistd.h>
17#endif 17#endif
18#include <stdlib.h> 18#include <stdlib.h>
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c
index 88eedeaa6..4920cd0f4 100644
--- a/e2fsprogs/e2fsck.c
+++ b/e2fsprogs/e2fsck.c
@@ -4309,7 +4309,7 @@ static int process_block(ext2_filsys fs,
4309 * Should never happen, since only directories 4309 * Should never happen, since only directories
4310 * get called with BLOCK_FLAG_HOLE 4310 * get called with BLOCK_FLAG_HOLE
4311 */ 4311 */
4312#if DEBUG_E2FSCK 4312#ifdef DEBUG_E2FSCK
4313 printf("process_block() called with blk == 0, " 4313 printf("process_block() called with blk == 0, "
4314 "blockcnt=%d, inode %lu???\n", 4314 "blockcnt=%d, inode %lu???\n",
4315 blockcnt, p->ino); 4315 blockcnt, p->ino);
diff --git a/e2fsprogs/e2p/fgetsetflags.c b/e2fsprogs/e2p/fgetsetflags.c
index 34e40551f..008b79850 100644
--- a/e2fsprogs/e2p/fgetsetflags.c
+++ b/e2fsprogs/e2p/fgetsetflags.c
@@ -16,15 +16,15 @@
16 * 93/10/30 - Creation 16 * 93/10/30 - Creation
17 */ 17 */
18 18
19#if HAVE_ERRNO_H 19#ifdef HAVE_ERRNO_H
20#include <errno.h> 20#include <errno.h>
21#endif 21#endif
22#if HAVE_UNISTD_H 22#ifdef HAVE_UNISTD_H
23#include <unistd.h> 23#include <unistd.h>
24#endif 24#endif
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/stat.h> 26#include <sys/stat.h>
27#if HAVE_EXT2_IOCTLS 27#ifdef HAVE_EXT2_IOCTLS
28#include <fcntl.h> 28#include <fcntl.h>
29#include <sys/ioctl.h> 29#include <sys/ioctl.h>
30#endif 30#endif
@@ -39,7 +39,7 @@
39 39
40int fgetsetflags (const char * name, unsigned long * get_flags, unsigned long set_flags) 40int fgetsetflags (const char * name, unsigned long * get_flags, unsigned long set_flags)
41{ 41{
42#if HAVE_EXT2_IOCTLS 42#ifdef HAVE_EXT2_IOCTLS
43 struct stat buf; 43 struct stat buf;
44 int fd, r, f, save_errno = 0; 44 int fd, r, f, save_errno = 0;
45 45
diff --git a/e2fsprogs/e2p/fgetsetversion.c b/e2fsprogs/e2p/fgetsetversion.c
index 48cea9df4..8d79054d6 100644
--- a/e2fsprogs/e2p/fgetsetversion.c
+++ b/e2fsprogs/e2p/fgetsetversion.c
@@ -17,10 +17,10 @@
17 * 93/10/30 - Creation 17 * 93/10/30 - Creation
18 */ 18 */
19 19
20#if HAVE_ERRNO_H 20#ifdef HAVE_ERRNO_H
21#include <errno.h> 21#include <errno.h>
22#endif 22#endif
23#if HAVE_UNISTD_H 23#ifdef HAVE_UNISTD_H
24#include <unistd.h> 24#include <unistd.h>
25#endif 25#endif
26#include <fcntl.h> 26#include <fcntl.h>
@@ -44,7 +44,7 @@
44 44
45int fgetsetversion (const char * name, unsigned long * get_version, unsigned long set_version) 45int fgetsetversion (const char * name, unsigned long * get_version, unsigned long set_version)
46{ 46{
47#if HAVE_EXT2_IOCTLS 47#ifdef HAVE_EXT2_IOCTLS
48 int fd, r, ver, save_errno = 0; 48 int fd, r, ver, save_errno = 0;
49 49
50 fd = open (name, OPEN_FLAGS); 50 fd = open (name, OPEN_FLAGS);
diff --git a/e2fsprogs/ext2fs/finddev.c b/e2fsprogs/ext2fs/finddev.c
index 4dda916d0..5e2cce940 100644
--- a/e2fsprogs/ext2fs/finddev.c
+++ b/e2fsprogs/ext2fs/finddev.c
@@ -13,22 +13,22 @@
13 13
14#include <stdio.h> 14#include <stdio.h>
15#include <string.h> 15#include <string.h>
16#if HAVE_UNISTD_H 16#ifdef HAVE_UNISTD_H
17#include <unistd.h> 17#include <unistd.h>
18#endif 18#endif
19#include <stdlib.h> 19#include <stdlib.h>
20#include <string.h> 20#include <string.h>
21#if HAVE_SYS_TYPES_H 21#ifdef HAVE_SYS_TYPES_H
22#include <sys/types.h> 22#include <sys/types.h>
23#endif 23#endif
24#if HAVE_SYS_STAT_H 24#ifdef HAVE_SYS_STAT_H
25#include <sys/stat.h> 25#include <sys/stat.h>
26#endif 26#endif
27#include <dirent.h> 27#include <dirent.h>
28#if HAVE_ERRNO_H 28#ifdef HAVE_ERRNO_H
29#include <errno.h> 29#include <errno.h>
30#endif 30#endif
31#if HAVE_SYS_MKDEV_H 31#ifdef HAVE_SYS_MKDEV_H
32#include <sys/mkdev.h> 32#include <sys/mkdev.h>
33#endif 33#endif
34 34
diff --git a/include/platform.h b/include/platform.h
index 91f43f30b..345e9cb7a 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -34,7 +34,7 @@
34#endif 34#endif
35 35
36#undef inline 36#undef inline
37#if __STDC_VERSION__ > 199901L 37#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L
38/* it's a keyword */ 38/* it's a keyword */
39#else 39#else
40# if __GNUC_PREREQ (2,7) 40# if __GNUC_PREREQ (2,7)
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 59b6f0acc..371f0fc94 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -29,7 +29,7 @@
29#include <net/if.h> 29#include <net/if.h>
30#include <net/if_arp.h> 30#include <net/if_arp.h>
31#include <netinet/in.h> 31#include <netinet/in.h>
32#if __GLIBC__ >=2 && __GLIBC_MINOR >= 1 32#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
33#include <netpacket/packet.h> 33#include <netpacket/packet.h>
34#include <net/ethernet.h> 34#include <net/ethernet.h>
35#else 35#else
diff --git a/networking/interface.c b/networking/interface.c
index 6c8e93879..8bbde7d43 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -738,7 +738,7 @@ static const struct hwtype loop_hwtype = {
738 738
739#include <net/if_arp.h> 739#include <net/if_arp.h>
740 740
741#if (__GLIBC__ >=2 && __GLIBC_MINOR >= 1) || defined(_NEWLIB_VERSION) 741#if (__GLIBC__ >=2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
742#include <net/ethernet.h> 742#include <net/ethernet.h>
743#else 743#else
744#include <linux/if_ether.h> 744#include <linux/if_ether.h>
diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c
index f026ab7e6..a3fe9d376 100644
--- a/networking/libiproute/ll_proto.c
+++ b/networking/libiproute/ll_proto.c
@@ -16,7 +16,7 @@
16#include "rt_names.h" 16#include "rt_names.h"
17#include "utils.h" 17#include "utils.h"
18 18
19#if __GLIBC__ >=2 && __GLIBC_MINOR >= 1 19#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
20#include <net/ethernet.h> 20#include <net/ethernet.h>
21#else 21#else
22#include <linux/if_ether.h> 22#include <linux/if_ether.h>
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c
index 58b26c171..4299c2dbd 100644
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -11,7 +11,7 @@
11#include <string.h> 11#include <string.h>
12#include <sys/socket.h> 12#include <sys/socket.h>
13#include <features.h> 13#include <features.h>
14#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION 14#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
15#include <netpacket/packet.h> 15#include <netpacket/packet.h>
16#include <net/ethernet.h> 16#include <net/ethernet.h>
17#else 17#else
diff --git a/networking/udhcp/clientsocket.c b/networking/udhcp/clientsocket.c
index 982aca1bb..6aa61754d 100644
--- a/networking/udhcp/clientsocket.c
+++ b/networking/udhcp/clientsocket.c
@@ -26,7 +26,7 @@
26#include <unistd.h> 26#include <unistd.h>
27#include <netinet/in.h> 27#include <netinet/in.h>
28#include <features.h> 28#include <features.h>
29#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION 29#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
30#include <netpacket/packet.h> 30#include <netpacket/packet.h>
31#include <net/ethernet.h> 31#include <net/ethernet.h>
32#else 32#else
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index f12ecd6ec..e861b825a 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -5,7 +5,7 @@
5#include <sys/types.h> 5#include <sys/types.h>
6#include <sys/socket.h> 6#include <sys/socket.h>
7#include <features.h> 7#include <features.h>
8#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION 8#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
9#include <netpacket/packet.h> 9#include <netpacket/packet.h>
10#include <net/ethernet.h> 10#include <net/ethernet.h>
11#else 11#else
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 3f481c33c..d1867e9a8 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -33,7 +33,7 @@
33#include <net/if.h> 33#include <net/if.h>
34#include <errno.h> 34#include <errno.h>
35#include <features.h> 35#include <features.h>
36#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION 36#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
37#include <netpacket/packet.h> 37#include <netpacket/packet.h>
38#include <net/ethernet.h> 38#include <net/ethernet.h>
39#else 39#else
diff --git a/procps/renice.c b/procps/renice.c
index bcaa94cf1..65674a4ee 100644
--- a/procps/renice.c
+++ b/procps/renice.c
@@ -20,23 +20,11 @@
20 */ 20 */
21 21
22#include "busybox.h" 22#include "busybox.h"
23#include <stdio.h>
24#include <stdlib.h>
25#include <string.h>
26#include <limits.h>
27#include <errno.h>
28#include <unistd.h>
29#include <sys/resource.h> 23#include <sys/resource.h>
30 24
31#if (PRIO_PROCESS < CHAR_MIN) || (PRIO_PROCESS > CHAR_MAX) 25void BUG_bad_PRIO_PROCESS(void);
32#error Assumption violated : PRIO_PROCESS value 26void BUG_bad_PRIO_PGRP(void);
33#endif 27void BUG_bad_PRIO_USER(void);
34#if (PRIO_PGRP < CHAR_MIN) || (PRIO_PGRP > CHAR_MAX)
35#error Assumption violated : PRIO_PGRP value
36#endif
37#if (PRIO_USER < CHAR_MIN) || (PRIO_USER > CHAR_MAX)
38#error Assumption violated : PRIO_USER value
39#endif
40 28
41int renice_main(int argc, char **argv) 29int renice_main(int argc, char **argv)
42{ 30{
@@ -49,6 +37,14 @@ int renice_main(int argc, char **argv)
49 unsigned who; 37 unsigned who;
50 char *arg; 38 char *arg;
51 39
40 /* Yes, they are not #defines in glibc 2.4! #if won't work */
41 if (PRIO_PROCESS < CHAR_MIN || PRIO_PROCESS > CHAR_MAX)
42 BUG_bad_PRIO_PROCESS();
43 if (PRIO_PGRP < CHAR_MIN || PRIO_PGRP > CHAR_MAX)
44 BUG_bad_PRIO_PGRP();
45 if (PRIO_USER < CHAR_MIN || PRIO_USER > CHAR_MAX)
46 BUG_bad_PRIO_USER();
47
52 arg = *++argv; 48 arg = *++argv;
53 49
54 /* Check if we are using a relative adjustment. */ 50 /* Check if we are using a relative adjustment. */
diff --git a/shell/ash.c b/shell/ash.c
index a34c871f1..3c7639707 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -42,6 +42,7 @@
42 * When debugging is on, debugging info will be written to ./trace and 42 * When debugging is on, debugging info will be written to ./trace and
43 * a quit signal will generate a core dump. 43 * a quit signal will generate a core dump.
44 */ 44 */
45#define DEBUG 0
45 46
46 47
47#define IFS_BROKEN 48#define IFS_BROKEN
@@ -50,7 +51,7 @@
50 51
51#include "busybox.h" 52#include "busybox.h"
52 53
53#ifdef DEBUG 54#if DEBUG
54#define _GNU_SOURCE 55#define _GNU_SOURCE
55#endif 56#endif
56 57
@@ -104,7 +105,7 @@ static int *dash_errno;
104#error "Do not even bother, ash will not run on uClinux" 105#error "Do not even bother, ash will not run on uClinux"
105#endif 106#endif
106 107
107#ifdef DEBUG 108#if DEBUG
108#define _DIAGASSERT(assert_expr) assert(assert_expr) 109#define _DIAGASSERT(assert_expr) assert(assert_expr)
109#else 110#else
110#define _DIAGASSERT(assert_expr) 111#define _DIAGASSERT(assert_expr)
@@ -582,7 +583,7 @@ static const char dolatstr[] = { CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' };
582static const char illnum[] = "Illegal number: %s"; 583static const char illnum[] = "Illegal number: %s";
583static const char homestr[] = "HOME"; 584static const char homestr[] = "HOME";
584 585
585#ifdef DEBUG 586#if DEBUG
586#define TRACE(param) trace param 587#define TRACE(param) trace param
587#define TRACEV(param) tracev param 588#define TRACEV(param) tracev param
588#else 589#else
@@ -1937,7 +1938,7 @@ struct shparam {
1937#define uflag optlist[12] 1938#define uflag optlist[12]
1938#define viflag optlist[13] 1939#define viflag optlist[13]
1939 1940
1940#ifdef DEBUG 1941#if DEBUG
1941#define nolog optlist[14] 1942#define nolog optlist[14]
1942#define debug optlist[15] 1943#define debug optlist[15]
1943#endif 1944#endif
@@ -1964,7 +1965,7 @@ static const char *const optletters_optnames[] = {
1964 "b" "notify", 1965 "b" "notify",
1965 "u" "nounset", 1966 "u" "nounset",
1966 "\0" "vi", 1967 "\0" "vi",
1967#ifdef DEBUG 1968#if DEBUG
1968 "\0" "nolog", 1969 "\0" "nolog",
1969 "\0" "debug", 1970 "\0" "debug",
1970#endif 1971#endif
@@ -2011,7 +2012,7 @@ static int redirectsafe(union node *, int);
2011/* show.h */ 2012/* show.h */
2012 2013
2013 2014
2014#ifdef DEBUG 2015#if DEBUG
2015static void showtree(union node *); 2016static void showtree(union node *);
2016static void trace(const char *, ...); 2017static void trace(const char *, ...);
2017static void tracev(const char *, va_list); 2018static void tracev(const char *, va_list);
@@ -2536,7 +2537,7 @@ static void exverror(int, const char *, va_list)
2536static void 2537static void
2537exraise(int e) 2538exraise(int e)
2538{ 2539{
2539#ifdef DEBUG 2540#if DEBUG
2540 if (handler == NULL) 2541 if (handler == NULL)
2541 abort(); 2542 abort();
2542#endif 2543#endif
@@ -2596,7 +2597,7 @@ exvwarning(const char *msg, va_list ap)
2596static void 2597static void
2597exverror(int cond, const char *msg, va_list ap) 2598exverror(int cond, const char *msg, va_list ap)
2598{ 2599{
2599#ifdef DEBUG 2600#if DEBUG
2600 if (msg) { 2601 if (msg) {
2601 TRACE(("exverror(%d, \"", cond)); 2602 TRACE(("exverror(%d, \"", cond));
2602 TRACEV((msg, ap)); 2603 TRACEV((msg, ap));
@@ -2785,7 +2786,7 @@ evaltree(union node *n, int flags)
2785 getpid(), n, n->type, flags)); 2786 getpid(), n, n->type, flags));
2786 switch (n->type) { 2787 switch (n->type) {
2787 default: 2788 default:
2788#ifdef DEBUG 2789#if DEBUG
2789 out1fmt("Node type = %d\n", n->type); 2790 out1fmt("Node type = %d\n", n->type);
2790 fflush(stdout); 2791 fflush(stdout);
2791 break; 2792 break;
@@ -4481,7 +4482,7 @@ commandcmd(int argc, char **argv)
4481 verify |= VERIFY_VERBOSE; 4482 verify |= VERIFY_VERBOSE;
4482 else if (c == 'v') 4483 else if (c == 'v')
4483 verify |= VERIFY_BRIEF; 4484 verify |= VERIFY_BRIEF;
4484#ifdef DEBUG 4485#if DEBUG
4485 else if (c != 'p') 4486 else if (c != 'p')
4486 abort(); 4487 abort();
4487#endif 4488#endif
@@ -4907,7 +4908,7 @@ expari(int quotes)
4907 4908
4908 while (*p != CTLARI) { 4909 while (*p != CTLARI) {
4909 p--; 4910 p--;
4910#ifdef DEBUG 4911#if DEBUG
4911 if (p < start) { 4912 if (p < start) {
4912 sh_error("missing CTLARI (shouldn't happen)"); 4913 sh_error("missing CTLARI (shouldn't happen)");
4913 } 4914 }
@@ -5100,7 +5101,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varfla
5100 } 5101 }
5101 5102
5102 subtype -= VSTRIMRIGHT; 5103 subtype -= VSTRIMRIGHT;
5103#ifdef DEBUG 5104#if DEBUG
5104 if (subtype < 0 || subtype > 3) 5105 if (subtype < 0 || subtype > 3)
5105 abort(); 5106 abort();
5106#endif 5107#endif
@@ -5223,7 +5224,7 @@ record:
5223 goto end; 5224 goto end;
5224 } 5225 }
5225 5226
5226#ifdef DEBUG 5227#if DEBUG
5227 switch (subtype) { 5228 switch (subtype) {
5228 case VSTRIMLEFT: 5229 case VSTRIMLEFT:
5229 case VSTRIMLEFTMAX: 5230 case VSTRIMLEFTMAX:
@@ -6460,7 +6461,7 @@ set_curjob(struct job *jp, unsigned mode)
6460 jpp = curp; 6461 jpp = curp;
6461 switch (mode) { 6462 switch (mode) {
6462 default: 6463 default:
6463#ifdef DEBUG 6464#if DEBUG
6464 abort(); 6465 abort();
6465#endif 6466#endif
6466 case CUR_DELETE: 6467 case CUR_DELETE:
@@ -6581,7 +6582,7 @@ usage:
6581 while ((c = nextopt("ls:")) != '\0') 6582 while ((c = nextopt("ls:")) != '\0')
6582 switch (c) { 6583 switch (c) {
6583 default: 6584 default:
6584#ifdef DEBUG 6585#if DEBUG
6585 abort(); 6586 abort();
6586#endif 6587#endif
6587 case 'l': 6588 case 'l':
@@ -6647,7 +6648,7 @@ usage:
6647} 6648}
6648#endif /* JOBS */ 6649#endif /* JOBS */
6649 6650
6650#if defined(JOBS) || defined(DEBUG) 6651#if defined(JOBS) || DEBUG
6651static int 6652static int
6652jobno(const struct job *jp) 6653jobno(const struct job *jp)
6653{ 6654{
@@ -7827,7 +7828,7 @@ chkmail(void)
7827 if (*p == '\0') 7828 if (*p == '\0')
7828 continue; 7829 continue;
7829 for (q = p ; *q ; q++); 7830 for (q = p ; *q ; q++);
7830#ifdef DEBUG 7831#if DEBUG
7831 if (q[-1] != '/') 7832 if (q[-1] != '/')
7832 abort(); 7833 abort();
7833#endif 7834#endif
@@ -7921,7 +7922,7 @@ ash_main(int argc, char **argv)
7921 goto state4; 7922 goto state4;
7922 } 7923 }
7923 handler = &jmploc; 7924 handler = &jmploc;
7924#ifdef DEBUG 7925#if DEBUG
7925 opentrace(); 7926 opentrace();
7926 trputs("Shell args: "); trargs(argv); 7927 trputs("Shell args: "); trargs(argv);
7927#endif 7928#endif
@@ -7988,7 +7989,7 @@ state4: /* XXX ??? - why isn't this before the "if" statement */
7988#if PROFILE 7989#if PROFILE
7989 monitor(0); 7990 monitor(0);
7990#endif 7991#endif
7991#if GPROF 7992#ifdef GPROF
7992 { 7993 {
7993 extern void _mcleanup(void); 7994 extern void _mcleanup(void);
7994 _mcleanup(); 7995 _mcleanup();
@@ -8266,7 +8267,7 @@ stalloc(size_t nbytes)
8266void 8267void
8267stunalloc(pointer p) 8268stunalloc(pointer p)
8268{ 8269{
8269#ifdef DEBUG 8270#if DEBUG
8270 if (!p || (stacknxt < (char *)p) || ((char *)p < stackp->space)) { 8271 if (!p || (stacknxt < (char *)p) || ((char *)p < stackp->space)) {
8271 write(2, "stunalloc\n", 10); 8272 write(2, "stunalloc\n", 10);
8272 abort(); 8273 abort();
@@ -8844,7 +8845,7 @@ setarg0:
8844void 8845void
8845optschanged(void) 8846optschanged(void)
8846{ 8847{
8847#ifdef DEBUG 8848#if DEBUG
8848 opentrace(); 8849 opentrace();
8849#endif 8850#endif
8850 setinteractive(iflag); 8851 setinteractive(iflag);
@@ -9913,7 +9914,7 @@ static int
9913readtoken(void) 9914readtoken(void)
9914{ 9915{
9915 int t; 9916 int t;
9916#ifdef DEBUG 9917#if DEBUG
9917 int alreadyseen = tokpushback; 9918 int alreadyseen = tokpushback;
9918#endif 9919#endif
9919 9920
@@ -9963,7 +9964,7 @@ top:
9963 } 9964 }
9964out: 9965out:
9965 checkkwd = 0; 9966 checkkwd = 0;
9966#ifdef DEBUG 9967#if DEBUG
9967 if (!alreadyseen) 9968 if (!alreadyseen)
9968 TRACE(("token %s %s\n", tokname(t), t == TWORD ? wordtext : "")); 9969 TRACE(("token %s %s\n", tokname(t), t == TWORD ? wordtext : ""));
9969 else 9970 else
@@ -11053,7 +11054,7 @@ openredirect(union node *redir)
11053 goto ecreate; 11054 goto ecreate;
11054 break; 11055 break;
11055 default: 11056 default:
11056#ifdef DEBUG 11057#if DEBUG
11057 abort(); 11058 abort();
11058#endif 11059#endif
11059 /* Fall through to eliminate warning. */ 11060 /* Fall through to eliminate warning. */
@@ -11255,7 +11256,7 @@ redirectsafe(union node *redir, int flags)
11255 11256
11256/* show.c */ 11257/* show.c */
11257 11258
11258#ifdef DEBUG 11259#if DEBUG
11259static void shtree(union node *, int, char *, FILE*); 11260static void shtree(union node *, int, char *, FILE*);
11260static void shcmd(union node *, FILE *); 11261static void shcmd(union node *, FILE *);
11261static void sharg(union node *, FILE *); 11262static void sharg(union node *, FILE *);
@@ -11714,7 +11715,7 @@ setsignal(int signo)
11714 action = S_CATCH; 11715 action = S_CATCH;
11715 break; 11716 break;
11716 case SIGQUIT: 11717 case SIGQUIT:
11717#ifdef DEBUG 11718#if DEBUG
11718 if (debug) 11719 if (debug)
11719 break; 11720 break;
11720#endif 11721#endif
@@ -13659,7 +13660,7 @@ static arith_t arith (const char *expr, int *perrcode)
13659#endif /* CONFIG_ASH_MATH_SUPPORT */ 13660#endif /* CONFIG_ASH_MATH_SUPPORT */
13660 13661
13661 13662
13662#ifdef DEBUG 13663#if DEBUG
13663const char *applet_name = "debug stuff usage"; 13664const char *applet_name = "debug stuff usage";
13664int main(int argc, char **argv) 13665int main(int argc, char **argv)
13665{ 13666{