diff options
| author | David M. Syzdek <david@syzdek.net> | 2022-01-10 18:30:55 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2022-01-10 18:30:55 -0900 |
| commit | bbef5cd0d8dc0036120f935dfa222d2f49bf5d63 (patch) | |
| tree | 68f6583e48d2791099d6c686f1c3d429f9d04c07 /src | |
| parent | 5f6034afdb8ad06b7bcbd1a2729f9a2e0600eb28 (diff) | |
| download | tinyrad-bbef5cd0d8dc0036120f935dfa222d2f49bf5d63.tar.gz tinyrad-bbef5cd0d8dc0036120f935dfa222d2f49bf5d63.tar.bz2 tinyrad-bbef5cd0d8dc0036120f935dfa222d2f49bf5d63.tar.xz tinyrad-bbef5cd0d8dc0036120f935dfa222d2f49bf5d63.zip | |
tinyrad-dict: adding support for debug messages
Diffstat (limited to 'src')
| -rw-r--r-- | src/utilities/tinyrad-dict.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/utilities/tinyrad-dict.c b/src/utilities/tinyrad-dict.c index 6ea538e..9cde33e 100644 --- a/src/utilities/tinyrad-dict.c +++ b/src/utilities/tinyrad-dict.c | |||
| @@ -85,6 +85,7 @@ void my_usage( void ); | |||
| 85 | 85 | ||
| 86 | int main(int argc, char * argv[]) | 86 | int main(int argc, char * argv[]) |
| 87 | { | 87 | { |
| 88 | int opt; | ||
| 88 | int c; | 89 | int c; |
| 89 | int opt_index; | 90 | int opt_index; |
| 90 | int rc; | 91 | int rc; |
| @@ -96,9 +97,10 @@ int main(int argc, char * argv[]) | |||
| 96 | char ** files; | 97 | char ** files; |
| 97 | 98 | ||
| 98 | // getopt options | 99 | // getopt options |
| 99 | static char short_opt[] = "D:hI:qVv"; | 100 | static char short_opt[] = "d:D:hI:qVv"; |
| 100 | static struct option long_opt[] = | 101 | static struct option long_opt[] = |
| 101 | { | 102 | { |
| 103 | {"debug", optional_argument, NULL, 'd' }, | ||
| 102 | {"help", no_argument, NULL, 'h' }, | 104 | {"help", no_argument, NULL, 'h' }, |
| 103 | {"quiet", no_argument, NULL, 'q' }, | 105 | {"quiet", no_argument, NULL, 'q' }, |
| 104 | {"silent", no_argument, NULL, 'q' }, | 106 | {"silent", no_argument, NULL, 'q' }, |
| @@ -109,6 +111,10 @@ int main(int argc, char * argv[]) | |||
| 109 | { NULL, 0, NULL, 0 } | 111 | { NULL, 0, NULL, 0 } |
| 110 | }; | 112 | }; |
| 111 | 113 | ||
| 114 | opt = TRAD_OPT_OFF; | ||
| 115 | tinyrad_set_option(NULL, TRAD_OPT_DEBUG_SYSLOG, &opt); | ||
| 116 | tinyrad_set_option(NULL, TRAD_OPT_DEBUG_IDENT, PROGRAM_NAME); | ||
| 117 | |||
| 112 | opts = 0; | 118 | opts = 0; |
| 113 | paths = NULL; | 119 | paths = NULL; |
| 114 | files = NULL; | 120 | files = NULL; |
| @@ -139,6 +145,11 @@ int main(int argc, char * argv[]) | |||
| 139 | }; | 145 | }; |
| 140 | break; | 146 | break; |
| 141 | 147 | ||
| 148 | case 'd': | ||
| 149 | opt = ((optarg)) ? (int)strtol(optarg, NULL, 0) : TRAD_DEBUG_ANY; | ||
| 150 | tinyrad_set_option(NULL, TRAD_OPT_DEBUG_LEVEL, &opt); | ||
| 151 | break; | ||
| 152 | |||
| 142 | case 'h': | 153 | case 'h': |
| 143 | my_usage(); | 154 | my_usage(); |
| 144 | return(0); | 155 | return(0); |
| @@ -239,6 +250,7 @@ void my_usage(void) | |||
| 239 | printf("Usage: %s [OPTIONS]\n", PROGRAM_NAME); | 250 | printf("Usage: %s [OPTIONS]\n", PROGRAM_NAME); |
| 240 | printf("OPTIONS:\n"); | 251 | printf("OPTIONS:\n"); |
| 241 | printf(" -D dictionary include dictionary\n"); | 252 | printf(" -D dictionary include dictionary\n"); |
| 253 | printf(" -d level, --debug=level print debug messages\n"); | ||
| 242 | printf(" -h, --help print this help and exit\n"); | 254 | printf(" -h, --help print this help and exit\n"); |
| 243 | printf(" -I path add path to dictionary search paths\n"); | 255 | printf(" -I path add path to dictionary search paths\n"); |
| 244 | printf(" -q, --quiet, --silent do not print messages\n"); | 256 | printf(" -q, --quiet, --silent do not print messages\n"); |
