2006-03-30 03:54:02 +08:00
|
|
|
/* vi: set sw=4 ts=4: */
|
2006-03-30 10:01:48 +08:00
|
|
|
/* This file was released into the public domain by Paul Fox.
|
2006-03-30 03:54:02 +08:00
|
|
|
*/
|
2007-05-27 03:00:18 +08:00
|
|
|
#include "libbb.h"
|
2005-08-02 00:04:40 +08:00
|
|
|
#include "bbconfigopts.h"
|
2010-08-29 20:36:11 +08:00
|
|
|
#if ENABLE_FEATURE_COMPRESS_BBCONFIG
|
2010-11-03 09:38:31 +08:00
|
|
|
# include "archive.h"
|
2010-08-29 20:36:11 +08:00
|
|
|
# include "bbconfigopts_bz2.h"
|
|
|
|
#endif
|
2005-08-02 00:04:40 +08:00
|
|
|
|
2007-10-11 18:05:36 +08:00
|
|
|
int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
2008-07-05 17:18:54 +08:00
|
|
|
int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
2005-08-02 00:04:40 +08:00
|
|
|
{
|
2010-08-29 20:36:11 +08:00
|
|
|
#if ENABLE_FEATURE_COMPRESS_BBCONFIG
|
|
|
|
bunzip_data *bd;
|
|
|
|
int i = start_bunzip(&bd,
|
|
|
|
/* src_fd: */ -1,
|
2010-10-29 05:08:53 +08:00
|
|
|
/* inbuf: */ bbconfig_config_bz2,
|
2010-08-29 20:36:11 +08: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 20:14:26 +08:00
|
|
|
full_write1_str(bbconfig_config);
|
2010-08-29 20:36:11 +08:00
|
|
|
#endif
|
2005-08-02 00:04:40 +08:00
|
|
|
return 0;
|
|
|
|
}
|