diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/tru/tinyradutil.c | 17 | ||||
| -rw-r--r-- | src/tru/widget-config.c | 4 | ||||
| -rw-r--r-- | src/tru/widget-dict.c | 4 | ||||
| -rw-r--r-- | src/tru/widget-url.c | 4 |
4 files changed, 16 insertions, 13 deletions
diff --git a/src/tru/tinyradutil.c b/src/tru/tinyradutil.c index a27b874..f0a17ac 100644 --- a/src/tru/tinyradutil.c +++ b/src/tru/tinyradutil.c | |||
| @@ -160,6 +160,7 @@ int main(int argc, char * argv[]) | |||
| 160 | TinyRadDict * dict; | 160 | TinyRadDict * dict; |
| 161 | TinyRadUtilConf cnfdata; | 161 | TinyRadUtilConf cnfdata; |
| 162 | TinyRadUtilConf * cnf; | 162 | TinyRadUtilConf * cnf; |
| 163 | char prog_name[128]; | ||
| 163 | 164 | ||
| 164 | // getopt options | 165 | // getopt options |
| 165 | static char short_opt[] = "+" TRU_COMMON_SHORT; | 166 | static char short_opt[] = "+" TRU_COMMON_SHORT; |
| @@ -190,8 +191,8 @@ int main(int argc, char * argv[]) | |||
| 190 | }; | 191 | }; |
| 191 | if ((argc - optind) < 1) | 192 | if ((argc - optind) < 1) |
| 192 | { | 193 | { |
| 193 | fprintf(stderr, "%s: missing required argument\n", PROGRAM_NAME); | 194 | fprintf(stderr, "%s: missing required argument\n", cnf->prog_name); |
| 194 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | 195 | fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); |
| 195 | return(1); | 196 | return(1); |
| 196 | }; | 197 | }; |
| 197 | 198 | ||
| @@ -202,10 +203,12 @@ int main(int argc, char * argv[]) | |||
| 202 | // looks up widget | 203 | // looks up widget |
| 203 | if ((cnf->widget = tru_widget_lookup(argv[optind], TRAD_NO)) == NULL) | 204 | if ((cnf->widget = tru_widget_lookup(argv[optind], TRAD_NO)) == NULL) |
| 204 | { | 205 | { |
| 205 | fprintf(stderr, "%s: unknown or ambiguous widget -- \"%s\"\n", PROGRAM_NAME, cnf->argv[0]); | 206 | fprintf(stderr, "%s: unknown or ambiguous widget -- \"%s\"\n", cnf->prog_name, cnf->argv[0]); |
| 206 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | 207 | fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); |
| 207 | return(1); | 208 | return(1); |
| 208 | }; | 209 | }; |
| 210 | snprintf(prog_name, sizeof(prog_name), "%s %s", cnf->prog_name, argv[optind]); | ||
| 211 | cnf->prog_name = prog_name; | ||
| 209 | }; | 212 | }; |
| 210 | 213 | ||
| 211 | // call widget | 214 | // call widget |
| @@ -335,12 +338,12 @@ tru_cli_parse( | |||
| 335 | return(TRU_GETOPT_EXIT); | 338 | return(TRU_GETOPT_EXIT); |
| 336 | 339 | ||
| 337 | case '?': | 340 | case '?': |
| 338 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | 341 | fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); |
| 339 | return(TRU_GETOPT_ERROR); | 342 | return(TRU_GETOPT_ERROR); |
| 340 | 343 | ||
| 341 | default: | 344 | default: |
| 342 | fprintf(stderr, "%s: unrecognized option `--%c'\n", PROGRAM_NAME, c); | 345 | fprintf(stderr, "%s: unrecognized option `--%c'\n", cnf->prog_name, c); |
| 343 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | 346 | fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); |
| 344 | return(TRU_GETOPT_ERROR); | 347 | return(TRU_GETOPT_ERROR); |
| 345 | }; | 348 | }; |
| 346 | }; | 349 | }; |
diff --git a/src/tru/widget-config.c b/src/tru/widget-config.c index cf52aec..1ff145a 100644 --- a/src/tru/widget-config.c +++ b/src/tru/widget-config.c | |||
| @@ -66,8 +66,8 @@ tru_widget_config( | |||
| 66 | return((rc == TRU_GETOPT_EXIT) ? 0 : 1); | 66 | return((rc == TRU_GETOPT_EXIT) ? 0 : 1); |
| 67 | if (optind < cnf->argc) | 67 | if (optind < cnf->argc) |
| 68 | { | 68 | { |
| 69 | fprintf(stderr, "%s: unrecognized argument `-- %s'\n", PROGRAM_NAME, cnf->argv[optind+1]); | 69 | fprintf(stderr, "%s: unrecognized argument `-- %s'\n", cnf->prog_name, cnf->argv[optind+1]); |
| 70 | fprintf(stderr, "Try `%s %s --help' for more information.\n", PROGRAM_NAME, cnf->widget_name); | 70 | fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); |
| 71 | return(1); | 71 | return(1); |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
diff --git a/src/tru/widget-dict.c b/src/tru/widget-dict.c index ac297d1..ff0165f 100644 --- a/src/tru/widget-dict.c +++ b/src/tru/widget-dict.c | |||
| @@ -66,8 +66,8 @@ tru_widget_dict( | |||
| 66 | return((rc == TRU_GETOPT_EXIT) ? 0 : 1); | 66 | return((rc == TRU_GETOPT_EXIT) ? 0 : 1); |
| 67 | if (optind < cnf->argc) | 67 | if (optind < cnf->argc) |
| 68 | { | 68 | { |
| 69 | fprintf(stderr, "%s: unrecognized argument `-- %s'\n", PROGRAM_NAME, cnf->argv[optind+1]); | 69 | fprintf(stderr, "%s: unrecognized argument `-- %s'\n", cnf->prog_name, cnf->argv[optind+1]); |
| 70 | fprintf(stderr, "Try `%s %s --help' for more information.\n", PROGRAM_NAME, cnf->widget_name); | 70 | fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); |
| 71 | return(1); | 71 | return(1); |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
diff --git a/src/tru/widget-url.c b/src/tru/widget-url.c index 4ff83d8..c712dda 100644 --- a/src/tru/widget-url.c +++ b/src/tru/widget-url.c | |||
| @@ -109,8 +109,8 @@ tru_widget_url( | |||
| 109 | return((rc == TRU_GETOPT_EXIT) ? 0 : 1); | 109 | return((rc == TRU_GETOPT_EXIT) ? 0 : 1); |
| 110 | if ( (optind >= cnf->argc) && (!(cnf->url)) ) | 110 | if ( (optind >= cnf->argc) && (!(cnf->url)) ) |
| 111 | { | 111 | { |
| 112 | fprintf(stderr, "%s: missing required argument\n", PROGRAM_NAME); | 112 | fprintf(stderr, "%s: missing required argument\n", cnf->prog_name); |
| 113 | fprintf(stderr, "Try `%s %s --help' for more information.\n", PROGRAM_NAME, cnf->widget_name); | 113 | fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); |
| 114 | return(1); | 114 | return(1); |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
