--- embedtools/src/cfger.c 2014/02/05 15:44:05 1.2 +++ embedtools/src/cfger.c 2017/06/28 15:19:32 1.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: cfger.c,v 1.2 2014/02/05 15:44:05 misho Exp $ + * $Id: cfger.c,v 1.3 2017/06/28 15:19:32 misho Exp $ * ************************************************************************* The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004 - 2014 +Copyright 2004 - 2017 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -61,6 +61,7 @@ Usage() " Syntax: cfger [options] [data]\n\n" "\t-v\t\tVerbose ...\n" "\t-q\t\tQuiet mode\n" + "\t-S\t\tShell script mode\n" "\t-o \tOutput result to file\n" "\t-l\t\tList A/V pairs\n" "\t-s \tSet A/V pair\n" @@ -72,12 +73,12 @@ Usage() int main(int argc, char **argv) { - char ch, *str, m = 0, q = 0, szAttr[STRSIZ], szName[PATH_MAX] = { 0 }; + char ch, *str, m = 0, q = 0, sh = 42, szAttr[STRSIZ], szName[PATH_MAX] = { 0 }; int ret = 0; ait_val_t data = AIT_VAL_INITIALIZER(data); FILE *out = stdout; - while ((ch = getopt(argc, argv, "hvqls:g:o:")) != -1) + while ((ch = getopt(argc, argv, "hvqlSs:g:o:")) != -1) switch (ch) { case 'v': Verbose++; @@ -85,6 +86,9 @@ main(int argc, char **argv) case 'q': q = 42; break; + case 'S': + sh ^= sh; + break; case 'o': strlcpy(szName, optarg, sizeof szName); break; @@ -171,7 +175,7 @@ main(int argc, char **argv) } case 'l': default: - cfgWriteConfig(out, &cfg, 42); + cfgWriteConfig(out, &cfg, sh); break; } end: