nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 743100feabc5eba36160b6e5e73f8c189a23d212
parent d3d2d324d21c61ef0f2b7f30541a20d31c66b7b9
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 24 Nov 2020 09:58:33 +0100

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.

Diffstat:
Msrc/nano.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -1848,7 +1848,7 @@ int main(int argc, char **argv) SET(RESTRICTED); 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) { #ifndef NANO_TINY case 'A': @@ -2001,7 +2001,6 @@ int main(int argc, char **argv) break; #endif case 'h': - case '?': usage(); exit(0); #ifndef NANO_TINY