blob: fe02516a82e9ee061b2d297acf1fa8bd0008dab5 [file] [log] [blame]
Paul Fox5139bd92006-03-29 19:54:02 +00001/* vi: set sw=4 ts=4: */
Denys Vlasenko2ab94032017-10-05 15:33:28 +02002/*
3 * This file was released into the public domain by Paul Fox.
Paul Fox5139bd92006-03-29 19:54:02 +00004 */
Denys Vlasenkofb4da162016-11-22 23:14:24 +01005//config:config BBCONFIG
Denys Vlasenkoae178ce2017-07-19 14:32:54 +02006//config: bool "bbconfig (9.7 kb)"
Denys Vlasenkofb4da162016-11-22 23:14:24 +01007//config: default n
8//config: help
Denys Vlasenko72089cf2017-07-21 09:50:55 +02009//config: The bbconfig applet will print the config file with which
10//config: busybox was built.
Denys Vlasenkofb4da162016-11-22 23:14:24 +010011//config:
12//config:config FEATURE_COMPRESS_BBCONFIG
13//config: bool "Compress bbconfig data"
14//config: default y
15//config: depends on BBCONFIG
16//config: help
Denys Vlasenko72089cf2017-07-21 09:50:55 +020017//config: Store bbconfig data in compressed form, uncompress them on-the-fly
18//config: before output.
Denys Vlasenkofb4da162016-11-22 23:14:24 +010019//config:
Denys Vlasenko72089cf2017-07-21 09:50:55 +020020//config: If you have a really tiny busybox with few applets enabled (and
21//config: bunzip2 isn't one of them), the overhead of the decompressor might
22//config: be noticeable. Also, if you run executables directly from ROM
23//config: and have very little memory, this might not be a win. Otherwise,
24//config: you probably want this.
Pere Orga5bc8c002011-04-11 03:29:49 +020025
Denys Vlasenkof88e3bf2016-11-22 23:54:17 +010026//applet:IF_BBCONFIG(APPLET(bbconfig, BB_DIR_BIN, BB_SUID_DROP))
27
28//kbuild:lib-$(CONFIG_BBCONFIG) += bbconfig.o
29
Pere Orga5bc8c002011-04-11 03:29:49 +020030//usage:#define bbconfig_trivial_usage
31//usage: ""
32//usage:#define bbconfig_full_usage "\n\n"
33//usage: "Print the config file used by busybox build"
34
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000035#include "libbb.h"
Paul Fox79c142d2005-08-01 16:04:40 +000036#include "bbconfigopts.h"
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020037#if ENABLE_FEATURE_COMPRESS_BBCONFIG
Denys Vlasenkod184a722011-09-22 12:45:14 +020038# include "bb_archive.h"
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020039# include "bbconfigopts_bz2.h"
40#endif
Paul Fox79c142d2005-08-01 16:04:40 +000041
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +000042int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Denis Vlasenkoa60f84e2008-07-05 09:18:54 +000043int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
Paul Fox79c142d2005-08-01 16:04:40 +000044{
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020045#if ENABLE_FEATURE_COMPRESS_BBCONFIG
Ron Yorstonc339c7f2018-11-02 14:14:31 +010046 const char *outbuf = unpack_bz2_data(bbconfig_config_bz2,
47 sizeof(bbconfig_config_bz2), sizeof(bbconfig_config));
48 if (outbuf) {
49 full_write1_str(outbuf);
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020050 }
51#else
Denys Vlasenko729ecb82010-06-07 14:14:26 +020052 full_write1_str(bbconfig_config);
Denys Vlasenko9ce07e72010-08-29 14:36:11 +020053#endif
Paul Fox79c142d2005-08-01 16:04:40 +000054 return 0;
55}