randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 7e35fa5..5f02233 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -168,9 +168,12 @@
 int cat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int cat_main(int argc UNUSED_PARAM, char **argv)
 {
+#if ENABLE_FEATURE_CATV || ENABLE_FEATURE_CATN
 	unsigned opts;
 
-	opts = getopt32(argv, IF_FEATURE_CATV("^")
+	opts =
+#endif
+	getopt32(argv, IF_FEATURE_CATV("^")
 		/* -u is ignored ("unbuffered") */
 		IF_FEATURE_CATV("etvA")IF_FEATURE_CATN("nb")"u"
 		IF_FEATURE_CATV("\0" "Aetv" /* -A == -vet */)
diff --git a/coreutils/ls.c b/coreutils/ls.c
index a4e324b..4be4990 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -482,12 +482,11 @@
 	int opt;
 #if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR
 	struct stat statbuf;
-	char append;
+#endif
+#if ENABLE_FEATURE_LS_FILETYPES
+	char append = append_char(dn->dn_mode);
 #endif
 
-#if ENABLE_FEATURE_LS_FILETYPES
-	append = append_char(dn->dn_mode);
-#endif
 	opt = option_mask32;
 
 	/* Do readlink early, so that if it fails, error message
diff --git a/coreutils/stat.c b/coreutils/stat.c
index dafbd4e..7ba3db1 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -759,10 +759,13 @@
 	IF_FEATURE_STAT_FORMAT(char *format = NULL;)
 	int i;
 	int ok;
-	unsigned opts;
 	statfunc_ptr statfunc = do_stat;
+#if ENABLE_FEATURE_STAT_FILESYSTEM || ENABLE_SELINUX
+	unsigned opts;
 
-	opts = getopt32(argv, "^"
+	opts =
+#endif
+	getopt32(argv, "^"
 		"tL"
 		IF_FEATURE_STAT_FILESYSTEM("f")
 		IF_SELINUX("Z")
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 57039b1..7658096 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -127,11 +127,9 @@
 {
 	uname_info_t uname_info;
 	IF_UNAME(const char *unknown_str = "unknown";)
-	unsigned toprint;
-
-	toprint = (1 << 4); /* "arch" = "uname -m" */
-
 #if ENABLE_UNAME
+	unsigned toprint = (1 << 4); /* "arch" = "uname -m" */
+
 	if (!ENABLE_BB_ARCH || applet_name[0] == 'u') {
 # if ENABLE_LONG_OPTS
 		static const char uname_longopts[] ALIGN1 =
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 73201a6..6e6d71a 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -124,6 +124,7 @@
 lib-$(CONFIG_FEATURE_CHECK_NAMES) += die_if_bad_username.o
 
 lib-$(CONFIG_NC) += udp_io.o
+lib-$(CONFIG_NETCAT) += udp_io.o
 lib-$(CONFIG_DNSD) += udp_io.o
 lib-$(CONFIG_NTPD) += udp_io.o
 lib-$(CONFIG_TFTP) += udp_io.o
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 5624a7f..896bbc8 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -90,7 +90,8 @@
 # define CHAR_T char
 # define BB_isspace(c) isspace(c)
 # if ENABLE_FEATURE_EDITING_VI
-static bool BB_isalnum_or_underscore(CHAR_T c) {
+static bool BB_isalnum_or_underscore(CHAR_T c)
+{
 	return ((unsigned)c < 256 && isalnum(c)) || c == '_';
 }
 # endif
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index ec11b30..6839eaf 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -142,7 +142,9 @@
 int addgroup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int addgroup_main(int argc UNUSED_PARAM, char **argv)
 {
+#if ENABLE_FEATURE_ADDUSER_TO_GROUP
 	unsigned opts;
+#endif
 	const char *gid = "0";
 
 	/* need to be root */
@@ -154,7 +156,10 @@
 	 *  addgroup --gid num group
 	 *  addgroup user group
 	 * Check for min, max and missing args */
-	opts = getopt32long(argv, "^" "g:S" "\0" "-1:?2", addgroup_longopts,
+#if ENABLE_FEATURE_ADDUSER_TO_GROUP
+	opts =
+#endif
+	getopt32long(argv, "^" "g:S" "\0" "-1:?2", addgroup_longopts,
 				&gid
 	);
 	/* move past the commandline options */
diff --git a/make_single_applets.sh b/make_single_applets.sh
index 329a27d..aa1ace2 100755
--- a/make_single_applets.sh
+++ b/make_single_applets.sh
@@ -12,8 +12,9 @@
 test -f include/applets.h || { echo "No include/applets.h file"; exit 1; }
 apps="`
 grep ^IF_ include/applets.h \
-| grep -v ^IF_FEATURE_ \
+| grep -v '^IF_FEATURE_' \
 | sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \
+| grep -v '^BUSYBOX$' \
 | sort | uniq
 `"
 
diff --git a/networking/tftp.c b/networking/tftp.c
index 73a9829..4cd3918 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -208,7 +208,7 @@
 #define G_error_pkt_reason (G.error_pkt[3])
 #define G_error_pkt_str    ((char*)(G.error_pkt + 4))
 
-#if ENABLE_FEATURE_TFTP_PROGRESS_BAR
+#if ENABLE_FEATURE_TFTP_PROGRESS_BAR && ENABLE_FEATURE_TFTP_BLOCKSIZE
 static void tftp_progress_update(void)
 {
 	bb_progress_update(&G.pmt, 0, G.pos, G.size);
@@ -227,6 +227,7 @@
 	}
 }
 #else
+# define tftp_progress_update() ((void)0)
 # define tftp_progress_init() ((void)0)
 # define tftp_progress_done() ((void)0)
 #endif
diff --git a/procps/kill.c b/procps/kill.c
index 24cc903..c95afb8 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -108,7 +108,10 @@
 {
 	char *arg;
 	pid_t pid;
-	int signo = SIGTERM, errors = 0, quiet = 0;
+	int signo = SIGTERM, errors = 0;
+#if ENABLE_KILL || ENABLE_KILLALL
+	int quiet = 0;
+#endif
 
 #if KILL_APPLET_CNT == 1
 # define is_killall  ENABLE_KILLALL
@@ -170,7 +173,9 @@
 
 	/* The -q quiet option */
 	if (is_killall && arg[1] == 'q' && arg[2] == '\0') {
+#if ENABLE_KILL || ENABLE_KILLALL
 		quiet = 1;
+#endif
 		arg = *++argv;
 		if (!arg)
 			bb_show_usage();
diff --git a/scripts/randomtest.loop b/scripts/randomtest.loop
index 4d14b65..edfbc5c 100755
--- a/scripts/randomtest.loop
+++ b/scripts/randomtest.loop
@@ -66,6 +66,7 @@
 			continue
 		fi
 	fi
+	grep -i 'warning:' "$dir/make.log"
 	rm -rf -- "$dir"
 	let cnt++
 done
diff --git a/shell/ash.c b/shell/ash.c
index e69ddb4..dfb7d4d 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9952,7 +9952,7 @@
 	switch (cmdentry.cmdtype) {
 	default: {
 
-#if ENABLE_FEATURE_SH_NOFORK
+#if ENABLE_FEATURE_SH_NOFORK && NUM_APPLETS > 1
 /* (1) BUG: if variables are set, we need to fork, or save/restore them
  *     around run_nofork_applet() call.
  * (2) Should this check also be done in forkshell()?
diff --git a/shell/hush.c b/shell/hush.c
index 708555a..df1b046 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2278,7 +2278,7 @@
 	return EXIT_SUCCESS;
 }
 
-#if ENABLE_HUSH_UNSET
+#if ENABLE_HUSH_UNSET || ENABLE_HUSH_GETOPTS
 static int unset_local_var(const char *name)
 {
 	return unset_local_var_len(name, strlen(name));
@@ -2300,7 +2300,7 @@
 	free(strings);
 }
 
-#if BASH_HOSTNAME_VAR || ENABLE_FEATURE_SH_MATH || ENABLE_HUSH_READ
+#if BASH_HOSTNAME_VAR || ENABLE_FEATURE_SH_MATH || ENABLE_HUSH_READ || ENABLE_HUSH_GETOPTS
 static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val)
 {
 	char *var = xasprintf("%s=%s", name, val);
@@ -5534,7 +5534,7 @@
 static char *encode_then_expand_string(const char *str, int process_bkslash, int do_unbackslash)
 {
 #if !BASH_PATTERN_SUBST
-	const int do_unbackslash = 1;
+	enum { do_unbackslash = 1 };
 #endif
 	char *exp_str;
 	struct in_str input;
@@ -8139,7 +8139,7 @@
 			return rcode;
 		}
 
-		if (ENABLE_FEATURE_SH_NOFORK) {
+		if (ENABLE_FEATURE_SH_NOFORK && NUM_APPLETS > 1) {
 			int n = find_applet_by_name(argv_expanded[0]);
 			if (n >= 0 && APPLET_IS_NOFORK(n)) {
 				rcode = redirect_and_varexp_helper(&new_env, &old_vars, command, &squirrel, argv_expanded);
@@ -8387,7 +8387,10 @@
 				rword, cond_code, last_rword);
 
 		sv_errexit_depth = G.errexit_depth;
-		if (IF_HAS_KEYWORDS(rword == RES_IF || rword == RES_ELIF ||)
+		if (
+#if ENABLE_HUSH_IF
+		    rword == RES_IF || rword == RES_ELIF ||
+#endif
 		    pi->followup != PIPE_SEQ
 		) {
 			G.errexit_depth++;