Paul Fox | 5139bd9 | 2006-03-29 19:54:02 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Denys Vlasenko | 2ab9403 | 2017-10-05 15:33:28 +0200 | [diff] [blame] | 2 | /* |
| 3 | * This file was released into the public domain by Paul Fox. |
Paul Fox | 5139bd9 | 2006-03-29 19:54:02 +0000 | [diff] [blame] | 4 | */ |
Denys Vlasenko | fb4da16 | 2016-11-22 23:14:24 +0100 | [diff] [blame] | 5 | //config:config BBCONFIG |
Denys Vlasenko | ae178ce | 2017-07-19 14:32:54 +0200 | [diff] [blame] | 6 | //config: bool "bbconfig (9.7 kb)" |
Denys Vlasenko | fb4da16 | 2016-11-22 23:14:24 +0100 | [diff] [blame] | 7 | //config: default n |
| 8 | //config: help |
Denys Vlasenko | 72089cf | 2017-07-21 09:50:55 +0200 | [diff] [blame] | 9 | //config: The bbconfig applet will print the config file with which |
| 10 | //config: busybox was built. |
Denys Vlasenko | fb4da16 | 2016-11-22 23:14:24 +0100 | [diff] [blame] | 11 | //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 Vlasenko | 72089cf | 2017-07-21 09:50:55 +0200 | [diff] [blame] | 17 | //config: Store bbconfig data in compressed form, uncompress them on-the-fly |
| 18 | //config: before output. |
Denys Vlasenko | fb4da16 | 2016-11-22 23:14:24 +0100 | [diff] [blame] | 19 | //config: |
Denys Vlasenko | 72089cf | 2017-07-21 09:50:55 +0200 | [diff] [blame] | 20 | //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 Orga | 5bc8c00 | 2011-04-11 03:29:49 +0200 | [diff] [blame] | 25 | |
Denys Vlasenko | f88e3bf | 2016-11-22 23:54:17 +0100 | [diff] [blame] | 26 | //applet:IF_BBCONFIG(APPLET(bbconfig, BB_DIR_BIN, BB_SUID_DROP)) |
| 27 | |
| 28 | //kbuild:lib-$(CONFIG_BBCONFIG) += bbconfig.o |
| 29 | |
Pere Orga | 5bc8c00 | 2011-04-11 03:29:49 +0200 | [diff] [blame] | 30 | //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 Vlasenko | b6adbf1 | 2007-05-26 19:00:18 +0000 | [diff] [blame] | 35 | #include "libbb.h" |
Paul Fox | 79c142d | 2005-08-01 16:04:40 +0000 | [diff] [blame] | 36 | #include "bbconfigopts.h" |
Denys Vlasenko | 9ce07e7 | 2010-08-29 14:36:11 +0200 | [diff] [blame] | 37 | #if ENABLE_FEATURE_COMPRESS_BBCONFIG |
Denys Vlasenko | d184a72 | 2011-09-22 12:45:14 +0200 | [diff] [blame] | 38 | # include "bb_archive.h" |
Denys Vlasenko | 9ce07e7 | 2010-08-29 14:36:11 +0200 | [diff] [blame] | 39 | # include "bbconfigopts_bz2.h" |
| 40 | #endif |
Paul Fox | 79c142d | 2005-08-01 16:04:40 +0000 | [diff] [blame] | 41 | |
Denis Vlasenko | 9b49a5e | 2007-10-11 10:05:36 +0000 | [diff] [blame] | 42 | int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
Denis Vlasenko | a60f84e | 2008-07-05 09:18:54 +0000 | [diff] [blame] | 43 | int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
Paul Fox | 79c142d | 2005-08-01 16:04:40 +0000 | [diff] [blame] | 44 | { |
Denys Vlasenko | 9ce07e7 | 2010-08-29 14:36:11 +0200 | [diff] [blame] | 45 | #if ENABLE_FEATURE_COMPRESS_BBCONFIG |
Ron Yorston | c339c7f | 2018-11-02 14:14:31 +0100 | [diff] [blame] | 46 | 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 Vlasenko | 9ce07e7 | 2010-08-29 14:36:11 +0200 | [diff] [blame] | 50 | } |
| 51 | #else |
Denys Vlasenko | 729ecb8 | 2010-06-07 14:14:26 +0200 | [diff] [blame] | 52 | full_write1_str(bbconfig_config); |
Denys Vlasenko | 9ce07e7 | 2010-08-29 14:36:11 +0200 | [diff] [blame] | 53 | #endif |
Paul Fox | 79c142d | 2005-08-01 16:04:40 +0000 | [diff] [blame] | 54 | return 0; |
| 55 | } |