static enum {
CLI_FLAG_MERGE = (1 << 0),
} flags;
-static FILE *input = stdin;
+static FILE *input;
static struct uci_context *ctx;
enum {
"Options:\n"
"\t-f <file> use <file> as input instead of stdin\n"
"\t-m when importing, merge data into an existing package\n"
- "\t-s force strict mode (stop on parser errors)\n"
+ "\t-s force strict mode (stop on parser errors, default)\n"
"\t-S disable strict mode\n"
+ "\t-n name unnamed sections on export (default)\n"
+ "\t-N don't name unnamed sections\n"
"\n",
argv[0]
);
static int uci_do_import(int argc, char **argv)
{
struct uci_package *package = NULL;
- char **configs = NULL;
char *name = NULL;
int ret = UCI_OK;
- char **p;
if (argc > 2)
return 255;
int ret;
int c;
+ input = stdin;
ctx = uci_alloc_context();
if (!ctx) {
fprintf(stderr, "Out of memory\n");
return 1;
}
- while((c = getopt(argc, argv, "mf:sS")) != -1) {
+ while((c = getopt(argc, argv, "mf:sSnN")) != -1) {
switch(c) {
case 'f':
input = fopen(optarg, "r");
ctx->flags &= ~UCI_FLAG_STRICT;
ctx->flags |= UCI_FLAG_PERROR;
break;
+ case 'n':
+ ctx->flags |= UCI_FLAG_EXPORT_NAME;
+ break;
+ case 'N':
+ ctx->flags &= ~UCI_FLAG_EXPORT_NAME;
+ break;
default:
uci_usage(argc, argv);
break;