source: MondoRescue/branches/3.2/mindi-busybox/miscutils/bbconfig.c@ 3232

Last change on this file since 3232 was 3232, checked in by Bruno Cornec, 10 years ago
  • Update mindi-busybox to 1.21.1
File size: 1.1 KB
Line 
1/* vi: set sw=4 ts=4: */
2/* This file was released into the public domain by Paul Fox.
3 */
4
5//usage:#define bbconfig_trivial_usage
6//usage: ""
7//usage:#define bbconfig_full_usage "\n\n"
8//usage: "Print the config file used by busybox build"
9
10#include "libbb.h"
11#include "bbconfigopts.h"
12#if ENABLE_FEATURE_COMPRESS_BBCONFIG
13# include "bb_archive.h"
14# include "bbconfigopts_bz2.h"
15#endif
16
17int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
19{
20#if ENABLE_FEATURE_COMPRESS_BBCONFIG
21 bunzip_data *bd;
22 int i = start_bunzip(&bd,
23 /* src_fd: */ -1,
24 /* inbuf: */ bbconfig_config_bz2,
25 /* len: */ sizeof(bbconfig_config_bz2));
26 /* read_bunzip can longjmp to start_bunzip, and ultimately
27 * end up here with i != 0 on read data errors! Not trivial */
28 if (!i) {
29 /* Cannot use xmalloc: will leak bd in NOFORK case! */
30 char *outbuf = malloc_or_warn(sizeof(bbconfig_config));
31 if (outbuf) {
32 read_bunzip(bd, outbuf, sizeof(bbconfig_config));
33 full_write1_str(outbuf);
34 }
35 }
36#else
37 full_write1_str(bbconfig_config);
38#endif
39 return 0;
40}
Note: See TracBrowser for help on using the repository browser.