diff options
| author | Richard Stallman | 2015-04-05 08:36:56 -0400 |
|---|---|---|
| committer | Richard Stallman | 2015-04-05 08:42:43 -0400 |
| commit | 4e23cd0ccde4ad1e14fe2870ccf140487af649b2 (patch) | |
| tree | b709ac1e92a892f6ec1faa85eb59a9e5960c25dd /lib/getopt.c | |
| parent | dca743f0941909a80e3f28c023977120b6203e20 (diff) | |
| parent | 16eec6fc55dcc05d1d819f18998e84a9580b2521 (diff) | |
| download | emacs-4e23cd0ccde4ad1e14fe2870ccf140487af649b2.tar.gz emacs-4e23cd0ccde4ad1e14fe2870ccf140487af649b2.zip | |
* mail/rmail.el (rmail-show-message-1): When displaying a mime message,
indicate start and finish in the echo area.
* mail/rmail.el (rmail-epa-decrypt): Disregard <pre> before armor.
Ignore more kinds of whitespace in mime headers.
Modify the decrypted mime part's mime type so it will be displayed
by default when visiting this message again.
* net/browse-url.el (browse-url-firefox-program): Prefer IceCat, doc.
(browse-url-firefox-arguments)
(browse-url-firefox-startup-arguments): Doc fix.
Diffstat (limited to 'lib/getopt.c')
| -rw-r--r-- | lib/getopt.c | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/lib/getopt.c b/lib/getopt.c index 3b9c585a28c..212cbf73410 100644 --- a/lib/getopt.c +++ b/lib/getopt.c | |||
| @@ -487,7 +487,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 487 | const struct option *p; | 487 | const struct option *p; |
| 488 | struct option_list *next; | 488 | struct option_list *next; |
| 489 | } *ambig_list = NULL; | 489 | } *ambig_list = NULL; |
| 490 | #ifdef _LIBC | ||
| 491 | /* malloc() not used for _LIBC to simplify failure messages. */ | ||
| 492 | # define free_option_list(l) | ||
| 493 | #else | ||
| 494 | # define free_option_list(l) \ | ||
| 495 | while (l != NULL) \ | ||
| 496 | { \ | ||
| 497 | struct option_list *pn = l->next; \ | ||
| 498 | free (l); \ | ||
| 499 | l = pn; \ | ||
| 500 | } | ||
| 501 | #endif | ||
| 490 | int exact = 0; | 502 | int exact = 0; |
| 503 | int ambig = 0; | ||
| 491 | int indfound = -1; | 504 | int indfound = -1; |
| 492 | int option_index; | 505 | int option_index; |
| 493 | 506 | ||
| @@ -514,22 +527,37 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 514 | pfound = p; | 527 | pfound = p; |
| 515 | indfound = option_index; | 528 | indfound = option_index; |
| 516 | } | 529 | } |
| 530 | else if (ambig) | ||
| 531 | ; /* Taking simpler path to handling ambiguities. */ | ||
| 517 | else if (long_only | 532 | else if (long_only |
| 518 | || pfound->has_arg != p->has_arg | 533 | || pfound->has_arg != p->has_arg |
| 519 | || pfound->flag != p->flag | 534 | || pfound->flag != p->flag |
| 520 | || pfound->val != p->val) | 535 | || pfound->val != p->val) |
| 521 | { | 536 | { |
| 522 | /* Second or later nonexact match found. */ | 537 | /* Second or later nonexact match found. */ |
| 538 | #ifdef _LIBC | ||
| 539 | struct option_list *newp = alloca (sizeof (*newp)); | ||
| 540 | #else | ||
| 523 | struct option_list *newp = malloc (sizeof (*newp)); | 541 | struct option_list *newp = malloc (sizeof (*newp)); |
| 524 | newp->p = p; | 542 | if (newp == NULL) |
| 525 | newp->next = ambig_list; | 543 | { |
| 526 | ambig_list = newp; | 544 | free_option_list (ambig_list); |
| 545 | ambig_list = NULL; | ||
| 546 | ambig = 1; /* Use simpler fallback message. */ | ||
| 547 | } | ||
| 548 | else | ||
| 549 | #endif | ||
| 550 | { | ||
| 551 | newp->p = p; | ||
| 552 | newp->next = ambig_list; | ||
| 553 | ambig_list = newp; | ||
| 554 | } | ||
| 527 | } | 555 | } |
| 528 | } | 556 | } |
| 529 | 557 | ||
| 530 | if (ambig_list != NULL && !exact) | 558 | if ((ambig || ambig_list) && !exact) |
| 531 | { | 559 | { |
| 532 | if (print_errors) | 560 | if (print_errors && ambig_list) |
| 533 | { | 561 | { |
| 534 | struct option_list first; | 562 | struct option_list first; |
| 535 | first.p = pfound; | 563 | first.p = pfound; |
| @@ -585,18 +613,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 585 | fputc ('\n', stderr); | 613 | fputc ('\n', stderr); |
| 586 | #endif | 614 | #endif |
| 587 | } | 615 | } |
| 616 | else if (print_errors && ambig) | ||
| 617 | { | ||
| 618 | fprintf (stderr, | ||
| 619 | _("%s: option '%s' is ambiguous\n"), | ||
| 620 | argv[0], argv[d->optind]); | ||
| 621 | } | ||
| 588 | d->__nextchar += strlen (d->__nextchar); | 622 | d->__nextchar += strlen (d->__nextchar); |
| 589 | d->optind++; | 623 | d->optind++; |
| 590 | d->optopt = 0; | 624 | d->optopt = 0; |
| 625 | free_option_list (ambig_list); | ||
| 591 | return '?'; | 626 | return '?'; |
| 592 | } | 627 | } |
| 593 | 628 | ||
| 594 | while (ambig_list != NULL) | 629 | free_option_list (ambig_list); |
| 595 | { | ||
| 596 | struct option_list *pn = ambig_list->next; | ||
| 597 | free (ambig_list); | ||
| 598 | ambig_list = pn; | ||
| 599 | } | ||
| 600 | 630 | ||
| 601 | if (pfound != NULL) | 631 | if (pfound != NULL) |
| 602 | { | 632 | { |