-D_GNU_SOURCE -DNDEBUG \
$(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \
-D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP \
- -Wall -Wstrict-prototypes -Wshadow -Werror \
+ -Wall -Wstrict-prototypes -Wshadow -Werror -Wundef \
-funsigned-char -fno-builtin-strlen -finline-limit=0 -static-libgcc \
-Os -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
-fomit-frame-pointer -ffunction-sections -fdata-sections
#include <stdio.h>
#include <unistd.h>
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/stat.h>
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#if HAVE_SYS_MKDEV_H
+#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
#include <time.h>
#include <stdio.h>
#include <string.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/stat.h>
#include <dirent.h>
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#if HAVE_SYS_MKDEV_H
+#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
*/
#include <stdio.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
* Should never happen, since only directories
* get called with BLOCK_FLAG_HOLE
*/
-#if DEBUG_E2FSCK
+#ifdef DEBUG_E2FSCK
printf("process_block() called with blk == 0, "
"blockcnt=%d, inode %lu???\n",
blockcnt, p->ino);
* 93/10/30 - Creation
*/
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
-#if HAVE_EXT2_IOCTLS
+#ifdef HAVE_EXT2_IOCTLS
#include <fcntl.h>
#include <sys/ioctl.h>
#endif
int fgetsetflags (const char * name, unsigned long * get_flags, unsigned long set_flags)
{
-#if HAVE_EXT2_IOCTLS
+#ifdef HAVE_EXT2_IOCTLS
struct stat buf;
int fd, r, f, save_errno = 0;
* 93/10/30 - Creation
*/
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
int fgetsetversion (const char * name, unsigned long * get_version, unsigned long set_version)
{
-#if HAVE_EXT2_IOCTLS
+#ifdef HAVE_EXT2_IOCTLS
int fd, r, ver, save_errno = 0;
fd = open (name, OPEN_FLAGS);
#include <stdio.h>
#include <string.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#if HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <dirent.h>
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#if HAVE_SYS_MKDEV_H
+#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
#endif
#undef inline
-#if __STDC_VERSION__ > 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L
/* it's a keyword */
#else
# if __GNUC_PREREQ (2,7)
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/in.h>
-#if __GLIBC__ >=2 && __GLIBC_MINOR >= 1
+#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
#include <netpacket/packet.h>
#include <net/ethernet.h>
#else
#include <net/if_arp.h>
-#if (__GLIBC__ >=2 && __GLIBC_MINOR >= 1) || defined(_NEWLIB_VERSION)
+#if (__GLIBC__ >=2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
#include <net/ethernet.h>
#else
#include <linux/if_ether.h>
#include "rt_names.h"
#include "utils.h"
-#if __GLIBC__ >=2 && __GLIBC_MINOR >= 1
+#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
#include <net/ethernet.h>
#else
#include <linux/if_ether.h>
#include <string.h>
#include <sys/socket.h>
#include <features.h>
-#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION
+#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
#include <netpacket/packet.h>
#include <net/ethernet.h>
#else
#include <unistd.h>
#include <netinet/in.h>
#include <features.h>
-#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION
+#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
#include <netpacket/packet.h>
#include <net/ethernet.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <features.h>
-#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION
+#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
#include <netpacket/packet.h>
#include <net/ethernet.h>
#else
#include <net/if.h>
#include <errno.h>
#include <features.h>
-#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION
+#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
#include <netpacket/packet.h>
#include <net/ethernet.h>
#else
*/
#include "busybox.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-#include <unistd.h>
#include <sys/resource.h>
-#if (PRIO_PROCESS < CHAR_MIN) || (PRIO_PROCESS > CHAR_MAX)
-#error Assumption violated : PRIO_PROCESS value
-#endif
-#if (PRIO_PGRP < CHAR_MIN) || (PRIO_PGRP > CHAR_MAX)
-#error Assumption violated : PRIO_PGRP value
-#endif
-#if (PRIO_USER < CHAR_MIN) || (PRIO_USER > CHAR_MAX)
-#error Assumption violated : PRIO_USER value
-#endif
+void BUG_bad_PRIO_PROCESS(void);
+void BUG_bad_PRIO_PGRP(void);
+void BUG_bad_PRIO_USER(void);
int renice_main(int argc, char **argv)
{
unsigned who;
char *arg;
+ /* Yes, they are not #defines in glibc 2.4! #if won't work */
+ if (PRIO_PROCESS < CHAR_MIN || PRIO_PROCESS > CHAR_MAX)
+ BUG_bad_PRIO_PROCESS();
+ if (PRIO_PGRP < CHAR_MIN || PRIO_PGRP > CHAR_MAX)
+ BUG_bad_PRIO_PGRP();
+ if (PRIO_USER < CHAR_MIN || PRIO_USER > CHAR_MAX)
+ BUG_bad_PRIO_USER();
+
arg = *++argv;
/* Check if we are using a relative adjustment. */
* When debugging is on, debugging info will be written to ./trace and
* a quit signal will generate a core dump.
*/
+#define DEBUG 0
#define IFS_BROKEN
#include "busybox.h"
-#ifdef DEBUG
+#if DEBUG
#define _GNU_SOURCE
#endif
#error "Do not even bother, ash will not run on uClinux"
#endif
-#ifdef DEBUG
+#if DEBUG
#define _DIAGASSERT(assert_expr) assert(assert_expr)
#else
#define _DIAGASSERT(assert_expr)
static const char illnum[] = "Illegal number: %s";
static const char homestr[] = "HOME";
-#ifdef DEBUG
+#if DEBUG
#define TRACE(param) trace param
#define TRACEV(param) tracev param
#else
#define uflag optlist[12]
#define viflag optlist[13]
-#ifdef DEBUG
+#if DEBUG
#define nolog optlist[14]
#define debug optlist[15]
#endif
"b" "notify",
"u" "nounset",
"\0" "vi",
-#ifdef DEBUG
+#if DEBUG
"\0" "nolog",
"\0" "debug",
#endif
/* show.h */
-#ifdef DEBUG
+#if DEBUG
static void showtree(union node *);
static void trace(const char *, ...);
static void tracev(const char *, va_list);
static void
exraise(int e)
{
-#ifdef DEBUG
+#if DEBUG
if (handler == NULL)
abort();
#endif
static void
exverror(int cond, const char *msg, va_list ap)
{
-#ifdef DEBUG
+#if DEBUG
if (msg) {
TRACE(("exverror(%d, \"", cond));
TRACEV((msg, ap));
getpid(), n, n->type, flags));
switch (n->type) {
default:
-#ifdef DEBUG
+#if DEBUG
out1fmt("Node type = %d\n", n->type);
fflush(stdout);
break;
verify |= VERIFY_VERBOSE;
else if (c == 'v')
verify |= VERIFY_BRIEF;
-#ifdef DEBUG
+#if DEBUG
else if (c != 'p')
abort();
#endif
while (*p != CTLARI) {
p--;
-#ifdef DEBUG
+#if DEBUG
if (p < start) {
sh_error("missing CTLARI (shouldn't happen)");
}
}
subtype -= VSTRIMRIGHT;
-#ifdef DEBUG
+#if DEBUG
if (subtype < 0 || subtype > 3)
abort();
#endif
goto end;
}
-#ifdef DEBUG
+#if DEBUG
switch (subtype) {
case VSTRIMLEFT:
case VSTRIMLEFTMAX:
jpp = curp;
switch (mode) {
default:
-#ifdef DEBUG
+#if DEBUG
abort();
#endif
case CUR_DELETE:
while ((c = nextopt("ls:")) != '\0')
switch (c) {
default:
-#ifdef DEBUG
+#if DEBUG
abort();
#endif
case 'l':
}
#endif /* JOBS */
-#if defined(JOBS) || defined(DEBUG)
+#if defined(JOBS) || DEBUG
static int
jobno(const struct job *jp)
{
if (*p == '\0')
continue;
for (q = p ; *q ; q++);
-#ifdef DEBUG
+#if DEBUG
if (q[-1] != '/')
abort();
#endif
goto state4;
}
handler = &jmploc;
-#ifdef DEBUG
+#if DEBUG
opentrace();
trputs("Shell args: "); trargs(argv);
#endif
#if PROFILE
monitor(0);
#endif
-#if GPROF
+#ifdef GPROF
{
extern void _mcleanup(void);
_mcleanup();
void
stunalloc(pointer p)
{
-#ifdef DEBUG
+#if DEBUG
if (!p || (stacknxt < (char *)p) || ((char *)p < stackp->space)) {
write(2, "stunalloc\n", 10);
abort();
void
optschanged(void)
{
-#ifdef DEBUG
+#if DEBUG
opentrace();
#endif
setinteractive(iflag);
readtoken(void)
{
int t;
-#ifdef DEBUG
+#if DEBUG
int alreadyseen = tokpushback;
#endif
}
out:
checkkwd = 0;
-#ifdef DEBUG
+#if DEBUG
if (!alreadyseen)
TRACE(("token %s %s\n", tokname(t), t == TWORD ? wordtext : ""));
else
goto ecreate;
break;
default:
-#ifdef DEBUG
+#if DEBUG
abort();
#endif
/* Fall through to eliminate warning. */
/* show.c */
-#ifdef DEBUG
+#if DEBUG
static void shtree(union node *, int, char *, FILE*);
static void shcmd(union node *, FILE *);
static void sharg(union node *, FILE *);
action = S_CATCH;
break;
case SIGQUIT:
-#ifdef DEBUG
+#if DEBUG
if (debug)
break;
#endif
#endif /* CONFIG_ASH_MATH_SUPPORT */
-#ifdef DEBUG
+#if DEBUG
const char *applet_name = "debug stuff usage";
int main(int argc, char **argv)
{