portability touch-up #2

Bernhard Fischer rep.nop at aon.at
Fri May 26 21:11:18 UTC 2006


This is the rest of the initial diff.

These bits are needed to be able to configure busybox with a non-gcc
C-compiler on a non-linux box.

Just for reference..
-------------- next part --------------
Index: scripts/config/bool.h
===================================================================
--- scripts/config/bool.h	(revision 0)
+++ scripts/config/bool.h	(revision 0)
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel at linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#ifndef __BOOL_H
+#define __BOOL_H
+
+#if !defined HAVE_STDBOOL_H && defined __GNUC__
+#define HAVE_STDBOOL_H 1
+#endif
+#ifndef HAVE_STDBOOL_H
+typedef char bool;
+# if !defined true
+#  undef true
+#  define true 1
+# endif
+# if !defined false
+#  undef false
+#  define false 0
+# endif
+#endif
+#endif /* __BOOL_H */
Index: scripts/config/zconf.tab.c_shipped
===================================================================
--- scripts/config/zconf.tab.c_shipped	(revision 15195)
+++ scripts/config/zconf.tab.c_shipped	(working copy)
@@ -159,7 +159,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdbool.h>
+#if !defined __cplusplus
+# if defined __GNUC__ || defined HAVE_STDBOOL_H
+# include <stdbool.h>
+# else
+# include "bool.h"
+# endif
+#endif
 
 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
 
Index: scripts/config/zconf.y
===================================================================
--- scripts/config/zconf.y	(revision 15195)
+++ scripts/config/zconf.y	(working copy)
@@ -9,7 +9,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdbool.h>
+#if !defined __cplusplus
+# if defined __GNUC__ || defined HAVE_STDBOOL_H
+# include <stdbool.h>
+# else
+# include "bool.h"
+# endif
+#endif
 
 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
 
Index: scripts/config/lkc.h
===================================================================
--- scripts/config/lkc.h	(revision 15195)
+++ scripts/config/lkc.h	(working copy)
@@ -6,6 +6,21 @@
 #ifndef LKC_H
 #define LKC_H
 
+#if !defined HAVE_STDBOOL_H && defined __GNUC__
+#define HAVE_STDBOOL_H 1
+#endif
+#ifndef HAVE_STDBOOL_H
+typedef char bool;
+# if !defined true
+#  undef true
+#  define true 1
+# endif
+# if !defined false
+#  undef false
+#  define false 0
+# endif
+#endif
+
 #include "expr.h"
 
 #ifdef __cplusplus
Index: scripts/config/confdata.c
===================================================================
--- scripts/config/confdata.c	(revision 15195)
+++ scripts/config/confdata.c	(working copy)
@@ -138,7 +138,11 @@ int conf_read(const char *name)
 			}
 			break;
 
-		case 'A' ... 'Z':
+		case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+		case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+		case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+		case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+		case 'Y': case 'Z':
 			p = strchr(line, '=');
 			if (!p)
 				continue;
@@ -452,9 +456,9 @@ int conf_write(const char *name)
 			if (out_h) {
 				fprintf(out_h, "#define ENABLE_%s %d\n", opt_name, use_flg);
 				fprintf(out_h, "#define USE_%s(...)%s\n", opt_name,
-					(use_flg ? "  __VA_ARGS__" : ""));
+					(use_flg ? " __VA_ARGS__" : ""));
 				fprintf(out_h, "#define SKIP_%s(...)%s\n\n", opt_name,
-					(use_flg ? "" : "  __VA_ARGS__"));
+					(use_flg ? "" : " __VA_ARGS__"));
 			}
 			/* end busybox`s code */
 		}
Index: scripts/config/expr.h
===================================================================
--- scripts/config/expr.h	(revision 15195)
+++ scripts/config/expr.h	(working copy)
@@ -11,10 +11,16 @@ extern "C" {
 #endif
 
 #include <stdio.h>
-#ifndef __cplusplus
-#include <stdbool.h>
+
+#if !defined __cplusplus
+# if defined HAVE_STDBOOL_H
+# include <stdbool.h>
+# else
+# include "bool.h"
+# endif
 #endif
 
+
 struct file {
 	struct file *next;
 	struct file *parent;
Index: networking/nslookup.c
===================================================================
--- networking/nslookup.c	(revision 15195)
+++ networking/nslookup.c	(working copy)
@@ -30,7 +30,6 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include <stdint.h>
 #include <netdb.h>
 #include <sys/socket.h>
 #include <sys/types.h>
Index: networking/libiproute/iptunnel.c
===================================================================
--- networking/libiproute/iptunnel.c	(revision 15195)
+++ networking/libiproute/iptunnel.c	(working copy)
@@ -33,11 +33,11 @@
 #endif
 #include <linux/if_tunnel.h>
 
+#include "libbb.h"
 #include "rt_names.h"
 #include "utils.h"
 #include "ip_common.h"
 
-#include "libbb.h"
 
 static int do_ioctl_get_ifindex(char *dev)
 {
Index: networking/libiproute/rtm_map.c
===================================================================
--- networking/libiproute/rtm_map.c	(revision 15195)
+++ networking/libiproute/rtm_map.c	(working copy)
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "libbb.h"
 #include "rt_names.h"
 #include "utils.h"
 
Index: networking/libiproute/ll_addr.c
===================================================================
--- networking/libiproute/ll_addr.c	(revision 15195)
+++ networking/libiproute/ll_addr.c	(working copy)
@@ -13,10 +13,10 @@
 #include <string.h>
 #include <net/if_arp.h>
 
+#include "libbb.h"
 #include "rt_names.h"
 #include "utils.h"
 
-#include "libbb.h"
 
 const char *ll_addr_n2a(unsigned char *addr, int alen, int type, char *buf, int blen)
 {
Index: networking/libiproute/rt_names.c
===================================================================
--- networking/libiproute/rt_names.c	(revision 15195)
+++ networking/libiproute/rt_names.c	(working copy)
@@ -12,7 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <stdint.h>
+#include "libbb.h"
 #include "rt_names.h"
 
 static void rtnl_tab_initialize(char *file, char **tab, int size)
Index: networking/libiproute/rt_names.h
===================================================================
--- networking/libiproute/rt_names.h	(revision 15195)
+++ networking/libiproute/rt_names.h	(working copy)
@@ -1,8 +1,6 @@
 #ifndef RT_NAMES_H_
 #define RT_NAMES_H_ 1
 
-#include <stdint.h>
-
 extern const char* rtnl_rtprot_n2a(int id, char *buf, int len);
 extern const char* rtnl_rtscope_n2a(int id, char *buf, int len);
 extern const char* rtnl_dsfield_n2a(int id, char *buf, int len);
Index: networking/libiproute/ipaddress.c
===================================================================
--- networking/libiproute/ipaddress.c	(revision 15195)
+++ networking/libiproute/ipaddress.c	(working copy)
@@ -22,12 +22,11 @@
 #include <net/if.h>
 #include <net/if_arp.h>
 
+#include "libbb.h"
 #include "rt_names.h"
 #include "utils.h"
 #include "ip_common.h"
 
-#include "libbb.h"
-
 static struct
 {
 	int ifindex;
Index: networking/libiproute/iplink.c
===================================================================
--- networking/libiproute/iplink.c	(revision 15195)
+++ networking/libiproute/iplink.c	(working copy)
@@ -29,13 +29,11 @@
 #include <linux/if_ether.h>
 #endif
 
+#include "libbb.h"
 #include "rt_names.h"
 #include "utils.h"
 #include "ip_common.h"
 
-#include "libbb.h"
-
-
 /* take from linux/sockios.h */
 #define SIOCSIFNAME	0x8923		/* set interface name */
 
Index: networking/libiproute/iproute.c
===================================================================
--- networking/libiproute/iproute.c	(revision 15195)
+++ networking/libiproute/iproute.c	(working copy)
@@ -20,11 +20,11 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include "libbb.h"
 #include "rt_names.h"
 #include "utils.h"
 #include "ip_common.h"
 
-#include "libbb.h"
 
 #ifndef RTAX_RTTVAR
 #define RTAX_RTTVAR RTAX_HOPS
Index: networking/libiproute/ll_proto.c
===================================================================
--- networking/libiproute/ll_proto.c	(revision 15195)
+++ networking/libiproute/ll_proto.c	(working copy)
@@ -13,6 +13,7 @@
 #include <arpa/inet.h>
 #include <string.h>
 
+#include "libbb.h"
 #include "rt_names.h"
 #include "utils.h"
 
Index: networking/libiproute/ll_types.c
===================================================================
--- networking/libiproute/ll_types.c	(revision 15195)
+++ networking/libiproute/ll_types.c	(working copy)
@@ -13,6 +13,7 @@
 
 #include <linux/if_arp.h>
 
+#include "libbb.h"
 #include "rt_names.h"
 
 const char * ll_type_n2a(int type, char *buf, int len)
Index: archival/libunarchive/decompress_unlzma.c
===================================================================
--- archival/libunarchive/decompress_unlzma.c	(revision 15195)
+++ archival/libunarchive/decompress_unlzma.c	(working copy)
@@ -20,10 +20,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <stdint.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <byteswap.h>
 
 #include "libbb.h"
 
Index: debianutils/run_parts.c
===================================================================
--- debianutils/run_parts.c	(revision 15195)
+++ debianutils/run_parts.c	(working copy)
@@ -10,21 +10,7 @@
  *   Copyright (C) 1996-1999 Guy Maor <maor at debian.org>
  *
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
 /* This is my first attempt to write a program in C (well, this is my first
@@ -49,17 +35,19 @@
  * done - declare run_parts_main() as extern and any other function as static?
  */
 
-#include <getopt.h>
 #include <stdlib.h>
+#include <getopt.h> /* optind */
 
 #include "busybox.h"
 
+#if ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS
 static const struct option runparts_long_options[] = {
 	{ "test",		0,		NULL,		't' },
 	{ "umask",		1,		NULL,		'u' },
 	{ "arg",		1,		NULL,		'a' },
 	{ 0,			0,		0,			0 }
 };
+#endif
 
 extern char **environ;
 
@@ -68,47 +56,32 @@ extern char **environ;
 int run_parts_main(int argc, char **argv)
 {
 	char **args = xmalloc(2 * sizeof(char *));
-	unsigned char test_mode = 0;
 	unsigned short argcount = 1;
+	char *opt_u, *opt_a;
 	int opt;
 
 	umask(022);
-
-	while ((opt = getopt_long (argc, argv, "tu:a:",
-					runparts_long_options, NULL)) > 0)
-	{
-		switch (opt) {
-			/* Enable test mode */
-			case 't':
-				test_mode++;
-				break;
-			/* Set the umask of the programs executed */
-			case 'u':
-				/* Check and set the umask of the program executed. As stated in the original
-				 * run-parts, the octal conversion in libc is not foolproof; it will take the
-				 * 8 and 9 digits under some circumstances. We'll just have to live with it.
-				 */
-				umask(bb_xgetlarg(optarg, 8, 0, 07777));
-				break;
-			/* Pass an argument to the programs */
-			case 'a':
-				/* Add an argument to the commands that we will call.
-				 * Called once for every argument. */
-				args = xrealloc(args, (argcount + 2) * (sizeof(char *)));
-				args[argcount++] = optarg;
-				break;
-			default:
-				bb_show_usage();
-		}
-	}
-
-	/* We require exactly one argument: the directory name */
-	if (optind != (argc - 1)) {
-		bb_show_usage();
+#if ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS
+	bb_applet_long_options = runparts_long_options;
+#endif
+	/* We require exactly one non-option argument: the directory name */
+	bb_opt_complementally="?1";
+	opt = bb_getopt_ulflags(argc, argv, "tu:a:", &opt_u, &opt_a);
+	if (opt & 2) /* u *//* Set the umask of the programs executed */
+		/* Check and set the umask of the program executed. As stated in the original
+		 * run-parts, the octal conversion in libc is not foolproof; it will take the
+		 * 8 and 9 digits under some circumstances. We'll just have to live with it.
+		 */
+		umask(bb_xgetlarg(opt_u, 8, 0, 07777));
+	if (opt & 4) {/* a *//* Pass an argument to the programs */
+		/* Add an argument to the commands that we will call.
+		 * Called once for every argument. */
+		args = xrealloc(args, (argcount + 2) * (sizeof(char *)));
+		args[argcount++] = opt_a;
 	}
 
 	args[0] = argv[optind];
 	args[argcount] = 0;
 
-	return(run_parts(args, test_mode, environ));
+	return(run_parts(args, (opt & 1), environ));
 }
Index: shell/ash.c
===================================================================
--- shell/ash.c	(revision 15195)
+++ shell/ash.c	(working copy)
@@ -77,7 +77,6 @@
 #include <paths.h>
 #include <setjmp.h>
 #include <signal.h>
-#include <stdint.h>
 #include <time.h>
 #include <fnmatch.h>
 
Index: coreutils/md5_sha1_sum.c
===================================================================
--- coreutils/md5_sha1_sum.c	(revision 15195)
+++ coreutils/md5_sha1_sum.c	(working copy)
@@ -9,7 +9,6 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <stdio.h>
-#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
Index: coreutils/df.c
===================================================================
--- coreutils/df.c	(revision 15195)
+++ coreutils/df.c	(working copy)
@@ -18,11 +18,14 @@
  * the command line.  Properly round *-blocks, Used, and Available quantities.
  */
 
+#include "platform.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <sys/vfs.h>
 #include "busybox.h"
 
Index: coreutils/dos2unix.c
===================================================================
--- coreutils/dos2unix.c	(revision 15195)
+++ coreutils/dos2unix.c	(working copy)
@@ -13,7 +13,6 @@
 
 #include <string.h>
 #include <unistd.h>
-#include <stdint.h>
 #include <fcntl.h>
 #include <sys/time.h>
 #include "busybox.h"
Index: coreutils/date.c
===================================================================
--- coreutils/date.c	(revision 15195)
+++ coreutils/date.c	(working copy)
@@ -129,7 +129,7 @@ int date_main(int argc, char **argv)
 
 	bb_opt_complementally = "?:d--s:s--d";
 	opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:"
-		  		 	USE_FEATURE_DATE_ISOFMT("I::D:"),
+					USE_FEATURE_DATE_ISOFMT("I::D:"),
 					&date_str, &date_str, &filename
 					USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg));
 	set_time = opt & DATE_OPT_SET;
Index: coreutils/stat.c
===================================================================
--- coreutils/stat.c	(revision 15195)
+++ coreutils/stat.c	(working copy)
@@ -13,7 +13,6 @@
  */
 
 #include <stdio.h>
-#include <stdint.h>
 #include <sys/types.h>
 #include <pwd.h>
 #include <grp.h>
Index: libbb/md5.c
===================================================================
--- libbb/md5.c	(revision 15195)
+++ libbb/md5.c	(working copy)
@@ -14,7 +14,6 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <stdio.h>
-#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
Index: libbb/sha1.c
===================================================================
--- libbb/sha1.c	(revision 15195)
+++ libbb/sha1.c	(working copy)
@@ -40,7 +40,6 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <stdio.h>
-#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
Index: libbb/find_mount_point.c
===================================================================
--- libbb/find_mount_point.c	(revision 15195)
+++ libbb/find_mount_point.c	(working copy)
@@ -12,6 +12,7 @@
 #include "libbb.h"
 
 
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
 /*
  * Given a block device, find the mount table entry if that block device
@@ -52,3 +53,4 @@ struct mntent *find_mount_point(const ch
 	endmntent(mountTable);
 	return mountEntry;
 }
+#endif
Index: libbb/getopt_ulflags.c
===================================================================
--- libbb/getopt_ulflags.c	(revision 15195)
+++ libbb/getopt_ulflags.c	(working copy)
@@ -297,6 +297,17 @@ typedef struct {
 	int *counter;
 } t_complementally;
 
+#ifndef no_argument
+struct option {
+	const char *name;
+	int has_arg;
+	int *flag;
+	int val;
+};
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+#endif
 /* You can set bb_applet_long_options for parse called long options */
 
 static const struct option bb_default_long_options[] = {
Index: libbb/mtab.c
===================================================================
--- libbb/mtab.c	(revision 15195)
+++ libbb/mtab.c	(working copy)
@@ -19,12 +19,15 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include "platform.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include "libbb.h"
 
 #define MTAB_MAX_ENTRIES 40
Index: e2fsprogs/e2fsck.h
===================================================================
--- e2fsprogs/e2fsck.h	(revision 15195)
+++ e2fsprogs/e2fsck.h	(working copy)
@@ -21,7 +21,9 @@
 #include <sys/mount.h>
 #include <sys/ioctl.h>
 #include <termios.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <dirent.h>
 #include "ext2fs/kernel-list.h"
 #include <sys/types.h>
Index: e2fsprogs/mke2fs.c
===================================================================
--- e2fsprogs/mke2fs.c	(revision 15195)
+++ e2fsprogs/mke2fs.c	(working copy)
@@ -23,7 +23,9 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <sys/ioctl.h>
 #include <sys/types.h>
 
Index: miscutils/adjtimex.c
===================================================================
--- miscutils/adjtimex.c	(revision 15195)
+++ miscutils/adjtimex.c	(working copy)
@@ -44,9 +44,23 @@
 #include <sys/types.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <sys/time.h>
 #include <sys/timex.h>
 #include "busybox.h"
 
+#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
+#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
+#endif
+#if !defined ADJ_FREQUENCY && defined MOD_FREQUENCY
+#define ADJ_FREQUENCY MOD_FREQUENCY
+#endif
+#if !defined ADJ_TIMECONST && defined MOD_TIMECONST
+#define ADJ_TIMECONST MOD_TIMECONST
+#endif
+#if !defined ADJ_TICK && defined MOD_CLKB
+#define ADJ_TICK MOD_CLKB
+#endif
+
 static const struct {int bit; const char *name;} statlist[] = {
 	{ STA_PLL,       "PLL"       },
 	{ STA_PPSFREQ,   "PPSFREQ"   },
Index: miscutils/hdparm.c
===================================================================
--- miscutils/hdparm.c	(revision 15195)
+++ miscutils/hdparm.c	(working copy)
@@ -17,7 +17,6 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
-#include <endian.h>
 #include <sys/ioctl.h>
 #include <sys/sysmacros.h>
 #include <sys/time.h>
Index: miscutils/eject.c
===================================================================
--- miscutils/eject.c	(revision 15195)
+++ miscutils/eject.c	(working copy)
@@ -12,11 +12,14 @@
  * Most of the dirty work blatantly ripped off from cat.c =)
  */
 
+#include "platform.h"
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
 #include <sys/mount.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include "busybox.h"
 
 /* various defines swiped from linux/cdrom.h */
Index: include/pwd_.h
===================================================================
--- include/pwd_.h	(revision 15195)
+++ include/pwd_.h	(working copy)
@@ -29,7 +29,6 @@
 #define	_PWD_H	1
 
 #include <sys/types.h>
-#include <features.h>
 #include <stdio.h>
 
 /* The passwd structure.  */
Index: include/busybox.h
===================================================================
--- include/busybox.h	(revision 15195)
+++ include/busybox.h	(working copy)
@@ -71,5 +71,6 @@ extern const struct BB_applet applets[];
 #ifdef DMALLOC
 #include <dmalloc.h>
 #endif
-
+#undef option
+//struct option {int i;};
 #endif							/* _BB_INTERNAL_H_ */
Index: include/grp_.h
===================================================================
--- include/grp_.h	(revision 15195)
+++ include/grp_.h	(working copy)
@@ -31,7 +31,6 @@
 
 
 #include <sys/types.h>
-#include <features.h>
 #include <stdio.h>
 
 
Index: include/inet_common.h
===================================================================
--- include/inet_common.h	(revision 15195)
+++ include/inet_common.h	(working copy)
@@ -8,7 +8,6 @@
  *
  */
 
-#include <features.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include "platform.h"
Index: libpwdgrp/pwd_grp_internal.c
===================================================================
--- libpwdgrp/pwd_grp_internal.c	(revision 15195)
+++ libpwdgrp/pwd_grp_internal.c	(working copy)
@@ -20,7 +20,6 @@
 #include <features.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdint.h>
 #include <string.h>
 #include <stddef.h>
 #include <errno.h>
Index: libpwdgrp/pwd_grp.c
===================================================================
--- libpwdgrp/pwd_grp.c	(revision 15195)
+++ libpwdgrp/pwd_grp.c	(working copy)
@@ -20,7 +20,6 @@
 #include <features.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdint.h>
 #include <string.h>
 #include <stddef.h>
 #include <errno.h>
Index: init/halt.c
===================================================================
--- init/halt.c	(revision 15195)
+++ init/halt.c	(working copy)
@@ -15,7 +15,19 @@
 
 int halt_main(int argc, char *argv[])
 {
-	static const int magic[] = {RB_HALT_SYSTEM, RB_POWER_OFF, RB_AUTOBOOT};
+	static const int magic[] = {
+#ifdef RB_HALT_SYSTEM
+RB_HALT_SYSTEM,
+#elif defined RB_HALT
+RB_HALT,
+#endif
+#ifdef RB_POWER_OFF
+RB_POWER_OFF,
+#elif defined RB_POWERDOWN
+RB_POWERDOWN,
+#endif
+RB_AUTOBOOT
+	};
 	static const int signals[] = {SIGUSR1, SIGUSR2, SIGTERM};
 
 	char *delay = "hpr";
Index: TODO
===================================================================
--- TODO	(revision 15195)
+++ TODO	(working copy)
@@ -252,6 +252,9 @@ Minor stuff:
 
 Code cleanup:
 
+Question or provide fallbacks for GNU-only functions:
+strchrnul
+
 Replace deprecated functions.
 
 bzero() -> memset()
Index: util-linux/fdisk.c
===================================================================
--- util-linux/fdisk.c	(revision 15195)
+++ util-linux/fdisk.c	(working copy)
@@ -30,8 +30,6 @@
 #include <sys/param.h>
 #include <sys/sysmacros.h>     /* major */
 
-#include <stdint.h>        /* for uint32_t, uint16_t, uint8_t, int16_t, etc */
-
 /* Copied from linux/major.h */
 #define FLOPPY_MAJOR    2
 
Index: util-linux/mount.c
===================================================================
--- util-linux/mount.c	(revision 15195)
+++ util-linux/mount.c	(working copy)
@@ -22,13 +22,16 @@
    mount_it_now() does the actual mount.
 */
 
+#include "platform.h"
 #include <limits.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <ctype.h>
 #include <sys/mount.h>
 #include <fcntl.h>		// for CONFIG_FEATURE_MOUNT_LOOP
Index: util-linux/swaponoff.c
===================================================================
--- util-linux/swaponoff.c	(revision 15195)
+++ util-linux/swaponoff.c	(working copy)
@@ -7,8 +7,11 @@
  * Licensed under the GPL v2, see the file LICENSE in this tarball.
  */
 
+#include "platform.h"
 #include <stdio.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <dirent.h>
 #include <errno.h>
 #include <string.h>
Index: util-linux/fbset.c
===================================================================
--- util-linux/fbset.c	(revision 15195)
+++ util-linux/fbset.c	(working copy)
@@ -19,7 +19,6 @@
 #include <errno.h>
 #include <ctype.h>
 #include <string.h>
-#include <stdint.h>
 #include <sys/ioctl.h>
 #include "busybox.h"
 
Index: util-linux/mkfs_minix.c
===================================================================
--- util-linux/mkfs_minix.c	(revision 15195)
+++ util-linux/mkfs_minix.c	(working copy)
@@ -62,6 +62,7 @@
  *	removed getopt based parser and added a hand rolled one.
  */
 
+#include "platform.h"
 #include <stdio.h>
 #include <time.h>
 #include <unistd.h>
@@ -70,11 +71,12 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <stdlib.h>
-#include <stdint.h>
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include "busybox.h"
 
 #define MINIX_ROOT_INO 1
Index: util-linux/umount.c
===================================================================
--- util-linux/umount.c	(revision 15195)
+++ util-linux/umount.c	(working copy)
@@ -11,9 +11,12 @@
  *
  */
 
+#include "platform.h"
 #include <limits.h>
 #include <stdio.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
Index: util-linux/fsck_minix.c
===================================================================
--- util-linux/fsck_minix.c	(revision 15195)
+++ util-linux/fsck_minix.c	(working copy)
@@ -86,6 +86,7 @@
  * enforced (but it's not much fun on a character device :-).
  */
 
+#include "platform.h"
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
@@ -94,7 +95,9 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <termios.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <sys/param.h>
 #include "busybox.h"
 


More information about the busybox mailing list