2006-03-29 19:54:02 +00:00
|
|
|
/* vi: set sw=4 ts=4: */
|
2017-10-05 15:33:28 +02:00
|
|
|
/*
|
|
|
|
* This file was released into the public domain by Paul Fox.
|
2006-03-29 19:54:02 +00:00
|
|
|
*/
|
2016-11-22 23:14:24 +01:00
|
|
|
//config:config BBCONFIG
|
2017-07-19 14:32:54 +02:00
|
|
|
//config: bool "bbconfig (9.7 kb)"
|
2016-11-22 23:14:24 +01:00
|
|
|
//config: default n
|
|
|
|
//config: help
|
2017-07-21 09:50:55 +02:00
|
|
|
//config: The bbconfig applet will print the config file with which
|
|
|
|
//config: busybox was built.
|
2016-11-22 23:14:24 +01:00
|
|
|
//config:
|
|
|
|
//config:config FEATURE_COMPRESS_BBCONFIG
|
|
|
|
//config: bool "Compress bbconfig data"
|
|
|
|
//config: default y
|
|
|
|
//config: depends on BBCONFIG
|
|
|
|
//config: help
|
2017-07-21 09:50:55 +02:00
|
|
|
//config: Store bbconfig data in compressed form, uncompress them on-the-fly
|
|
|
|
//config: before output.
|
2016-11-22 23:14:24 +01:00
|
|
|
//config:
|
2017-07-21 09:50:55 +02:00
|
|
|
//config: If you have a really tiny busybox with few applets enabled (and
|
|
|
|
//config: bunzip2 isn't one of them), the overhead of the decompressor might
|
|
|
|
//config: be noticeable. Also, if you run executables directly from ROM
|
|
|
|
//config: and have very little memory, this might not be a win. Otherwise,
|
|
|
|
//config: you probably want this.
|
2011-04-11 03:29:49 +02:00
|
|
|
|
2016-11-22 23:54:17 +01:00
|
|
|
//applet:IF_BBCONFIG(APPLET(bbconfig, BB_DIR_BIN, BB_SUID_DROP))
|
|
|
|
|
|
|
|
//kbuild:lib-$(CONFIG_BBCONFIG) += bbconfig.o
|
|
|
|
|
2011-04-11 03:29:49 +02:00
|
|
|
//usage:#define bbconfig_trivial_usage
|
|
|
|
//usage: ""
|
|
|
|
//usage:#define bbconfig_full_usage "\n\n"
|
|
|
|
//usage: "Print the config file used by busybox build"
|
|
|
|
|
2007-05-26 19:00:18 +00:00
|
|
|
#include "libbb.h"
|
2005-08-01 16:04:40 +00:00
|
|
|
#include "bbconfigopts.h"
|
2010-08-29 14:36:11 +02:00
|
|
|
#if ENABLE_FEATURE_COMPRESS_BBCONFIG
|
2011-09-22 12:45:14 +02:00
|
|
|
# include "bb_archive.h"
|
2010-08-29 14:36:11 +02:00
|
|
|
# include "bbconfigopts_bz2.h"
|
|
|
|
#endif
|
2005-08-01 16:04:40 +00:00
|
|
|
|
2007-10-11 10:05:36 +00:00
|
|
|
int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
2008-07-05 09:18:54 +00:00
|
|
|
int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
2005-08-01 16:04:40 +00:00
|
|
|
{
|
2010-08-29 14:36:11 +02:00
|
|
|
#if ENABLE_FEATURE_COMPRESS_BBCONFIG
|
|
|
|
bunzip_data *bd;
|
|
|
|
int i = start_bunzip(&bd,
|
|
|
|
/* src_fd: */ -1,
|
2010-10-28 23:08:53 +02:00
|
|
|
/* inbuf: */ bbconfig_config_bz2,
|
2010-08-29 14:36:11 +02:00
|
|
|
/* len: */ sizeof(bbconfig_config_bz2));
|
|
|
|
/* read_bunzip can longjmp to start_bunzip, and ultimately
|
|
|
|
* end up here with i != 0 on read data errors! Not trivial */
|
|
|
|
if (!i) {
|
|
|
|
/* Cannot use xmalloc: will leak bd in NOFORK case! */
|
|
|
|
char *outbuf = malloc_or_warn(sizeof(bbconfig_config));
|
|
|
|
if (outbuf) {
|
|
|
|
read_bunzip(bd, outbuf, sizeof(bbconfig_config));
|
|
|
|
full_write1_str(outbuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
2010-06-07 14:14:26 +02:00
|
|
|
full_write1_str(bbconfig_config);
|
2010-08-29 14:36:11 +02:00
|
|
|
#endif
|
2005-08-01 16:04:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|