… | |
… | |
35 | * Version 1.1.0: Tue Jun 30 2000 |
35 | * Version 1.1.0: Tue Jun 30 2000 |
36 | * Added NLS support (partly written by Arkadiusz Mi<B6>kiewicz |
36 | * Added NLS support (partly written by Arkadiusz Mi<B6>kiewicz |
37 | * <misiek@pld.org.pl>) |
37 | * <misiek@pld.org.pl>) |
38 | * Version 1.1.4: Mon Nov 7 2005 |
38 | * Version 1.1.4: Mon Nov 7 2005 |
39 | * Fixed a few type's in the manpage |
39 | * Fixed a few type's in the manpage |
|
|
40 | * Version 1.1.5: Mon Nov 7 2005 |
|
|
41 | * Sync with util-linux-2.21, fixed build problems, many new translations |
40 | */ |
42 | */ |
41 | |
43 | |
42 | /* Exit codes: |
44 | /* Exit codes: |
43 | * 0) No errors, succesful operation. |
45 | * 0) No errors, succesful operation. |
44 | * 1) getopt(3) returned an error. |
46 | * 1) getopt(3) returned an error. |
… | |
… | |
195 | if (opt == LONG_OPT) { |
197 | if (opt == LONG_OPT) { |
196 | printf(" --%s", longopts[longindex].name); |
198 | printf(" --%s", longopts[longindex].name); |
197 | if (longopts[longindex].has_arg) |
199 | if (longopts[longindex].has_arg) |
198 | printf(" %s", normalize(optarg ? optarg : "")); |
200 | printf(" %s", normalize(optarg ? optarg : "")); |
199 | } else if (opt == NON_OPT) |
201 | } else if (opt == NON_OPT) |
200 | printf(" %s", normalize(optarg)); |
202 | printf(" %s", normalize(optarg ? optarg : "")); |
201 | else { |
203 | else { |
202 | printf(" -%c", opt); |
204 | printf(" -%c", opt); |
203 | charptr = strchr(optstr, opt); |
205 | charptr = strchr(optstr, opt); |
204 | if (charptr != NULL && *++charptr == ':') |
206 | if (charptr != NULL && *++charptr == ':') |
205 | printf(" %s", normalize(optarg ? optarg : "")); |
207 | printf(" %s", normalize(optarg ? optarg : "")); |
… | |
… | |
220 | * we already sent a message, we just exit with a helpful hint. |
222 | * we already sent a message, we just exit with a helpful hint. |
221 | */ |
223 | */ |
222 | static void __attribute__ ((__noreturn__)) parse_error(const char *message) |
224 | static void __attribute__ ((__noreturn__)) parse_error(const char *message) |
223 | { |
225 | { |
224 | if (message) |
226 | if (message) |
225 | fprintf(stderr, "%s: %s\n", ,program_short_invocation_name, message); |
227 | fprintf(stderr, "%s: %s\n", program_invocation_short_name, message); |
226 | fprintf(stderr, _("Try `%s --help' for more information.\n"), |
228 | fprintf(stderr, _("Try `%s --help' for more information.\n"), |
227 | program_invocation_short_name); |
229 | program_invocation_short_name); |
228 | exit(PARAMETER_EXIT_CODE); |
230 | exit(PARAMETER_EXIT_CODE); |
229 | } |
231 | } |
230 | |
232 | |
… | |
… | |
256 | long_options[long_options_nr].name = NULL; |
258 | long_options[long_options_nr].name = NULL; |
257 | long_options[long_options_nr].has_arg = 0; |
259 | long_options[long_options_nr].has_arg = 0; |
258 | long_options[long_options_nr].flag = NULL; |
260 | long_options[long_options_nr].flag = NULL; |
259 | long_options[long_options_nr].val = 0; |
261 | long_options[long_options_nr].val = 0; |
260 | |
262 | |
261 | if (long_options_nr) { |
263 | if (long_options_nr && name) { |
262 | /* Not for init! */ |
264 | /* Not for init! */ |
263 | long_options[long_options_nr - 1].has_arg = has_arg; |
265 | long_options[long_options_nr - 1].has_arg = has_arg; |
264 | long_options[long_options_nr - 1].flag = NULL; |
266 | long_options[long_options_nr - 1].flag = NULL; |
265 | long_options[long_options_nr - 1].val = LONG_OPT; |
267 | long_options[long_options_nr - 1].val = LONG_OPT; |
266 | tmp = xmalloc(strlen(name) + 1); |
268 | tmp = xmalloc(strlen(name) + 1); |
… | |
… | |
360 | {"alternative", no_argument, NULL, 'a'}, |
362 | {"alternative", no_argument, NULL, 'a'}, |
361 | {"name", required_argument, NULL, 'n'}, |
363 | {"name", required_argument, NULL, 'n'}, |
362 | {"version", no_argument, NULL, 'V'}, |
364 | {"version", no_argument, NULL, 'V'}, |
363 | {NULL, 0, NULL, 0} |
365 | {NULL, 0, NULL, 0} |
364 | }; |
366 | }; |
365 | #if WITHOUT_GETTEXT |
|
|
366 | #else |
|
|
367 | setlocale(LC_ALL, ""); |
367 | setlocale(LC_ALL, ""); |
368 | bindtextdomain(PACKAGE, LOCALEDIR); |
368 | bindtextdomain(PACKAGE, LOCALEDIR); |
369 | textdomain(PACKAGE); |
369 | textdomain(PACKAGE); |
370 | #endif |
|
|
371 | |
370 | |
372 | init_longopt(); |
371 | init_longopt(); |
373 | getopt_long_fp = getopt_long; |
372 | getopt_long_fp = getopt_long; |
374 | |
373 | |
375 | if (getenv("GETOPT_COMPATIBLE")) |
374 | if (getenv("GETOPT_COMPATIBLE")) |