~vcs-imports/nano/master

« back to all changes in this revision

Viewing changes to src/nano.c

  • Committer: Benno Schulenberg
  • Date: 2023-08-27 12:56:05 UTC
  • Revision ID: git-v1:75b312ded1f1b7b3b33b36c7ab936e9c27e01d0d
revert the previous commit -- forget about -? as a synonym for --help

An ambiguous option like --back or --word would cause nano to spew
the entire help text.  It should do the latter only when the user
explicitly requests it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
607
607
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
608
608
        print_opt("-g", "--showcursor", N_("Show cursor in file browser & help text"));
609
609
#endif
610
 
        print_opt("-h, -?", "--help", N_("Show this help text and exit"));
 
610
        print_opt("-h", "--help", N_("Show this help text and exit"));
611
611
#ifndef NANO_TINY
612
612
        print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
613
613
        print_opt("-j", "--jumpyscrolling", N_("Scroll per half-screen, not per line"));
1849
1849
                SET(RESTRICTED);
1850
1850
 
1851
1851
        while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RS$T:UVWX:Y:Z"
1852
 
                                "abcdef:gh?ijklmno:pqr:s:tuvwxy!%_0", long_options, NULL)) != -1) {
 
1852
                                "abcdef:ghijklmno:pqr:s:tuvwxy!%_0", long_options, NULL)) != -1) {
1853
1853
                switch (optchr) {
1854
1854
#ifndef NANO_TINY
1855
1855
                        case 'A':
1999
1999
                                SET(SHOW_CURSOR);
2000
2000
                                break;
2001
2001
#endif
 
2002
                        case 'h':
 
2003
                                usage();
 
2004
                                exit(0);
2002
2005
#ifndef NANO_TINY
2003
2006
                        case 'i':
2004
2007
                                SET(AUTOINDENT);
2095
2098
                                SET(ZERO);
2096
2099
                                break;
2097
2100
#endif
2098
 
                        case 'h':
2099
 
                        case '?':
2100
 
                                /* If the option is valid, print the help text and exit. */
2101
 
                                if (!optopt) {
2102
 
                                        usage();
2103
 
                                        exit(0);
2104
 
                                }
 
2101
                        default:
2105
2102
                                printf(_("Type '%s -h' for a list of available options.\n"), argv[0]);
2106
2103
                                exit(1);
2107
2104
                }