From de05a7024f4be6826d05c40aa029fe2bbf6d2818 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 31 Jan 2007 14:37:01 -0500 Subject: [PATCH] Add "make defconfig". Modify global options to start with CONFIG_TOYBOX_. --- Config.in | 4 ++-- Makefile | 4 ++++ kconfig/Makefile | 6 +++--- lib/args.c | 3 ++- toys/catv.c | 2 +- toys/df.c | 2 +- toys/pwd.c | 2 +- toys/toysh.c | 2 +- toys/which.c | 2 +- 9 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Config.in b/Config.in index 51b3cda..4218bcb 100644 --- a/Config.in +++ b/Config.in @@ -2,7 +2,7 @@ mainmenu "ToyBox Configuration" menu "Global settings" -config TOYS_FREE +config TOYBOX_FREE bool "Free memory unnecessarily" default n help @@ -12,7 +12,7 @@ config TOYS_FREE without a real OS (ala newlib+libgloss), enable this to make toybox clean up after itself. -config DEBUG +config TOYBOX_DEBUG bool "Debugging tests" default n help diff --git a/Makefile b/Makefile index c366b13..471c089 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,10 @@ all: toybox include kconfig/Makefile +# defconfig is the "maximum sane config"; allyesconfig minus debugging and such. +defconfig: allyesconfig + @sed -i -r -e "s/^(CONFIG_(TOYBOX_DEBUG|TOYBOX_FREE))=.*/# \1 is not set/" .config + .config: Config.in toys/Config.in # The long and roundabout sed is to make old versions of sed happy. New ones diff --git a/kconfig/Makefile b/kconfig/Makefile index 46a8f6e..f66432e 100644 --- a/kconfig/Makefile +++ b/kconfig/Makefile @@ -5,7 +5,7 @@ KCONFIG_TOP = Config.in obj = ./kconfig PHONY += clean help oldconfig menuconfig config silentoldconfig \ - randconfig allyesconfig allnoconfig allmodconfig defconfig + randconfig allyesconfig allnoconfig allmodconfig #defconfig menuconfig: $(obj)/mconf $< $(KCONFIG_TOP) @@ -28,8 +28,8 @@ allyesconfig: $(obj)/conf allnoconfig: $(obj)/conf $< -n $(KCONFIG_TOP) -defconfig: $(obj)/conf - $< -d $(KCONFIG_TOP) +#defconfig: $(obj)/conf +# $< -d $(KCONFIG_TOP) # Help text used by make help help:: diff --git a/lib/args.c b/lib/args.c index 9290293..2c17951 100644 --- a/lib/args.c +++ b/lib/args.c @@ -169,7 +169,8 @@ void get_optflags(void) // Find the end of the longopt for (end = ++options; *end && *end != ')'; end++); - if (CFG_DEBUG && !*end) error_exit("Unterminated optstring"); + if (CFG_TOYBOX_DEBUG && !*end) + error_exit("Unterminated optstring"); // Allocate and init a new struct longopts lo = xmalloc(sizeof(struct longopts)); diff --git a/toys/catv.c b/toys/catv.c index 9097c06..ee23061 100644 --- a/toys/catv.c +++ b/toys/catv.c @@ -53,7 +53,7 @@ int catv_main(void) putchar(c); } } - if (CFG_TOYS_FREE && fd) close(fd); + if (CFG_TOYBOX_FREE && fd) close(fd); } while (*++argv); return retval; diff --git a/toys/df.c b/toys/df.c index 3e8a972..52a6c1d 100644 --- a/toys/df.c +++ b/toys/df.c @@ -113,7 +113,7 @@ int df_main(void) } } - if (CFG_TOYS_FREE) llist_free(mtlist, NULL); + if (CFG_TOYBOX_FREE) llist_free(mtlist, NULL); return 0; } diff --git a/toys/pwd.c b/toys/pwd.c index 59d7223..a6fdd44 100644 --- a/toys/pwd.c +++ b/toys/pwd.c @@ -10,7 +10,7 @@ int pwd_main(void) char *pwd = xgetcwd(); xprintf("%s\n", pwd); - if (CFG_TOYS_FREE) free(pwd); + if (CFG_TOYBOX_FREE) free(pwd); return 0; } diff --git a/toys/toysh.c b/toys/toysh.c index 074907e..c383b89 100644 --- a/toys/toysh.c +++ b/toys/toysh.c @@ -212,7 +212,7 @@ int toysh_main(void) if (1 > getline(&command, &cmdlen, f ? : stdin)) break; handle(command); } - if (CFG_TOYS_FREE) free(command); + if (CFG_TOYBOX_FREE) free(command); } return 1; diff --git a/toys/which.c b/toys/which.c index 16e19d0..df7566c 100644 --- a/toys/which.c +++ b/toys/which.c @@ -61,7 +61,7 @@ int which_main(void) int i; for (i=0; toys.optargs[i]; i++) rc |= which_in_path(toys.optargs[i]); } - // if (CFG_TOYS_FREE) free(argv); + // if (CFG_TOYBOX_FREE) free(argv); return rc; } -- 2.7.4