|
|
| version 1.2.14.1, 2017/06/28 15:17:30 | version 1.3.2.1, 2017/06/29 08:29:02 |
|---|---|
| Line 62 Usage() | Line 62 Usage() |
| "\t-v\t\tVerbose ...\n" | "\t-v\t\tVerbose ...\n" |
| "\t-q\t\tQuiet mode\n" | "\t-q\t\tQuiet mode\n" |
| "\t-S\t\tShell script mode\n" | "\t-S\t\tShell script mode\n" |
| "\t-C\t\tWithout comment header\n" | |
| "\t-o <output>\tOutput result to file\n" | "\t-o <output>\tOutput result to file\n" |
| "\t-l\t\tList A/V pairs\n" | "\t-l\t\tList A/V pairs\n" |
| "\t-c <comment>\tAdds comment on header of file\n" | |
| "\t-s <attr>\tSet A/V pair\n" | "\t-s <attr>\tSet A/V pair\n" |
| "\t-g <attr>\tGet value from A/V pair\n" | "\t-g <attr>\tGet value from A/V pair\n" |
| "*\"attr\" format: [section/]attribute\n" | "*\"attr\" format: [section/]attribute\n" |
| Line 77 main(int argc, char **argv) | Line 79 main(int argc, char **argv) |
| int ret = 0; | int ret = 0; |
| ait_val_t data = AIT_VAL_INITIALIZER(data); | ait_val_t data = AIT_VAL_INITIALIZER(data); |
| FILE *out = stdout; | FILE *out = stdout; |
| time_t tim; | |
| struct tm tm; | |
| char cm = 42, szComment[STRSIZ] = { [0 ... STRSIZ - 1] = 0 }, szTim[STRSIZ] = { 0 }; | |
| while ((ch = getopt(argc, argv, "hvqlSs:g:o:")) != -1) | while ((ch = getopt(argc, argv, "hvqlSCs:g:o:c:")) != -1) |
| switch (ch) { | switch (ch) { |
| case 'v': | case 'v': |
| Verbose++; | Verbose++; |
| Line 89 main(int argc, char **argv) | Line 94 main(int argc, char **argv) |
| case 'S': | case 'S': |
| sh ^= sh; | sh ^= sh; |
| break; | break; |
| case 'C': | |
| cm ^= cm; | |
| break; | |
| case 'o': | case 'o': |
| strlcpy(szName, optarg, sizeof szName); | strlcpy(szName, optarg, sizeof szName); |
| break; | break; |
| case 'c': | |
| strlcpy(szComment, optarg, sizeof szComment); | |
| break; | |
| case 'l': | case 'l': |
| if (m) { | if (m) { |
| Usage(); | Usage(); |
| Line 175 main(int argc, char **argv) | Line 186 main(int argc, char **argv) |
| } | } |
| case 'l': | case 'l': |
| default: | default: |
| if (cm) { | |
| time(&tim); | |
| localtime_r(&tim, &tm); | |
| strftime(szTim, sizeof szTim, "%Y-%m-%d %H:%M:%S", &tm); | |
| fprintf(out, "# Auto-generated file %s from cfger at %s\n#\n# %s\n\n", *argv, szTim, szComment); | |
| } | |
| cfgWriteConfig(out, &cfg, sh); | cfgWriteConfig(out, &cfg, sh); |
| break; | break; |
| } | } |