mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-21 00:32:07 +03:00
options: do not spew out the help text when an option is not recognized
When getopt() does not recognize an option, it returns '?', which means
that '-?' cannot be used as a valid option because any invalid option
would be treated the same way as '-?'.
Spewing out the full help text drowns the "invalid option" message at
the beginning.
This fixes https://savannah.gnu.org/bugs/?59530.
Bug existed since version 5.3, commit 5bd92d4c
.
This commit is contained in:
parent
d3d2d324d2
commit
743100feab
@ -1848,7 +1848,7 @@ int main(int argc, char **argv)
|
|||||||
SET(RESTRICTED);
|
SET(RESTRICTED);
|
||||||
|
|
||||||
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
|
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
|
||||||
"abcdef:ghijklmno:pqr:s:tuvwxyz$?%!", long_options, NULL)) != -1) {
|
"abcdef:ghijklmno:pqr:s:tuvwxyz$%!", long_options, NULL)) != -1) {
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -2001,7 +2001,6 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
|
||||||
usage();
|
usage();
|
||||||
exit(0);
|
exit(0);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
Loading…
Reference in New Issue
Block a user