source: MondoRescue/branches/2.2.9/mindi-busybox/miscutils/bbconfig.c@ 3320

Last change on this file since 3320 was 3320, checked in by Bruno Cornec, 9 years ago
  • Re-add (thanks git BTW) the 2.2.9 branch which had been destroyed in the move to 3.0
  • Property svn:eol-style set to native
File size: 972 bytes
Line 
1/* vi: set sw=4 ts=4: */
2/* This file was released into the public domain by Paul Fox.
3 */
4#include "libbb.h"
5#include "bbconfigopts.h"
6#if ENABLE_FEATURE_COMPRESS_BBCONFIG
7# include "archive.h"
8# include "bbconfigopts_bz2.h"
9#endif
10
11int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
12int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
13{
14#if ENABLE_FEATURE_COMPRESS_BBCONFIG
15 bunzip_data *bd;
16 int i = start_bunzip(&bd,
17 /* src_fd: */ -1,
18 /* inbuf: */ bbconfig_config_bz2,
19 /* len: */ sizeof(bbconfig_config_bz2));
20 /* read_bunzip can longjmp to start_bunzip, and ultimately
21 * end up here with i != 0 on read data errors! Not trivial */
22 if (!i) {
23 /* Cannot use xmalloc: will leak bd in NOFORK case! */
24 char *outbuf = malloc_or_warn(sizeof(bbconfig_config));
25 if (outbuf) {
26 read_bunzip(bd, outbuf, sizeof(bbconfig_config));
27 full_write1_str(outbuf);
28 }
29 }
30#else
31 full_write1_str(bbconfig_config);
32#endif
33 return 0;
34}
Note: See TracBrowser for help on using the repository browser.