diff options
Diffstat (limited to 'src/tinyrad.c')
| -rw-r--r-- | src/tinyrad.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tinyrad.c b/src/tinyrad.c index 6832b00..097c31b 100644 --- a/src/tinyrad.c +++ b/src/tinyrad.c | |||
| @@ -69,6 +69,7 @@ | |||
| 69 | #define MY_OPT_DICT_DEFAULTS 0x0001UL | 69 | #define MY_OPT_DICT_DEFAULTS 0x0001UL |
| 70 | #define MY_OPT_DICT_DUMP 0x0002UL | 70 | #define MY_OPT_DICT_DUMP 0x0002UL |
| 71 | #define MY_OPT_DICT_LOADED 0x0004UL | 71 | #define MY_OPT_DICT_LOADED 0x0004UL |
| 72 | #define MY_OPT_CONFIG_PRINT 0x0008UL | ||
| 72 | 73 | ||
| 73 | 74 | ||
| 74 | ////////////////// | 75 | ////////////////// |
| @@ -144,6 +145,7 @@ int main(int argc, char * argv[]) | |||
| 144 | {"silent", no_argument, NULL, 'q' }, | 145 | {"silent", no_argument, NULL, 'q' }, |
| 145 | {"version", no_argument, NULL, 'V' }, | 146 | {"version", no_argument, NULL, 'V' }, |
| 146 | {"verbose", no_argument, NULL, 'v' }, | 147 | {"verbose", no_argument, NULL, 'v' }, |
| 148 | {"configuration", no_argument, NULL, 3 }, | ||
| 147 | {"defaults", no_argument, NULL, 2 }, | 149 | {"defaults", no_argument, NULL, 2 }, |
| 148 | {"dictionary-dump", no_argument, NULL, 1 }, | 150 | {"dictionary-dump", no_argument, NULL, 1 }, |
| 149 | { NULL, 0, NULL, 0 } | 151 | { NULL, 0, NULL, 0 } |
| @@ -174,6 +176,10 @@ int main(int argc, char * argv[]) | |||
| 174 | tr_opts |= TRAD_BUILTIN_DICT; | 176 | tr_opts |= TRAD_BUILTIN_DICT; |
| 175 | break; | 177 | break; |
| 176 | 178 | ||
| 179 | case 3: | ||
| 180 | opts |= MY_OPT_CONFIG_PRINT; | ||
| 181 | break; | ||
| 182 | |||
| 177 | case 'D': | 183 | case 'D': |
| 178 | if (tinyrad_strsadd(&dict_files, optarg) != TRAD_SUCCESS) | 184 | if (tinyrad_strsadd(&dict_files, optarg) != TRAD_SUCCESS) |
| 179 | { | 185 | { |
| @@ -258,6 +264,16 @@ int main(int argc, char * argv[]) | |||
| 258 | return(0); | 264 | return(0); |
| 259 | }; | 265 | }; |
| 260 | 266 | ||
| 267 | // display configuration | ||
| 268 | if ((opts & MY_OPT_CONFIG_PRINT)) | ||
| 269 | { | ||
| 270 | tinyrad_get_option(tr, TRAD_OPT_DICTIONARY, &dict); | ||
| 271 | tinyrad_conf_print(tr, dict); | ||
| 272 | tinyrad_free(tr); | ||
| 273 | tinyrad_free(dict); | ||
| 274 | return(0); | ||
| 275 | }; | ||
| 276 | |||
| 261 | tinyrad_free(tr); | 277 | tinyrad_free(tr); |
| 262 | 278 | ||
| 263 | return(0); | 279 | return(0); |
| @@ -338,6 +354,7 @@ void my_usage(void) | |||
| 338 | printf(" -v, --verbose print verbose messages\n"); | 354 | printf(" -v, --verbose print verbose messages\n"); |
| 339 | printf(" --defaults load default dictionaries\n"); | 355 | printf(" --defaults load default dictionaries\n"); |
| 340 | printf(" --dictionary-dump print imported dictionaries\n"); | 356 | printf(" --dictionary-dump print imported dictionaries\n"); |
| 357 | printf(" --configuration print configuration\n"); | ||
| 341 | printf("\n"); | 358 | printf("\n"); |
| 342 | return; | 359 | return; |
| 343 | } | 360 | } |
