Not showing options that don't have any effect when asking for --help in

restricted mode.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5327 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-07-29 19:31:50 +00:00
parent e4294a211e
commit 5885e34b23
2 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,8 @@
* src/text.c (do_linter): When the linter is called in restricted mode * src/text.c (do_linter): When the linter is called in restricted mode
(possible when nano was built with --disable-speller), it is better to (possible when nano was built with --disable-speller), it is better to
say that this function is disabled than that no linter was defined. say that this function is disabled than that no linter was defined.
* src/nano.c (usage): When asking for --help in restricted mode, don't
show options that don't have any effect.
2015-07-28 Benno Schulenberg <bensberg@justemail.net> 2015-07-28 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_formatter), src/nano.c (allow_pending_sigwinch): * src/text.c (do_formatter), src/nano.c (allow_pending_sigwinch):

View File

@ -842,15 +842,18 @@ void usage(void)
N_("Start at line LINE, column COLUMN")); N_("Start at line LINE, column COLUMN"));
#ifndef NANO_TINY #ifndef NANO_TINY
print_opt("-A", "--smarthome", N_("Enable smart home key")); print_opt("-A", "--smarthome", N_("Enable smart home key"));
if (!ISSET(RESTRICTED)) {
print_opt("-B", "--backup", N_("Save backups of existing files")); print_opt("-B", "--backup", N_("Save backups of existing files"));
print_opt(_("-C <dir>"), _("--backupdir=<dir>"), print_opt(_("-C <dir>"), _("--backupdir=<dir>"),
N_("Directory for saving unique backup files")); N_("Directory for saving unique backup files"));
}
#endif #endif
print_opt("-D", "--boldtext", N_("Use bold instead of reverse video text")); print_opt("-D", "--boldtext", N_("Use bold instead of reverse video text"));
#ifndef NANO_TINY #ifndef NANO_TINY
print_opt("-E", "--tabstospaces", N_("Convert typed tabs to spaces")); print_opt("-E", "--tabstospaces", N_("Convert typed tabs to spaces"));
#endif #endif
#ifndef DISABLE_MULTIBUFFER #ifndef DISABLE_MULTIBUFFER
if (!ISSET(RESTRICTED))
print_opt("-F", "--multibuffer", print_opt("-F", "--multibuffer",
N_("Read a file into a new buffer by default")); N_("Read a file into a new buffer by default"));
#endif #endif
@ -858,10 +861,12 @@ void usage(void)
print_opt("-G", "--locking", N_("Use (vim-style) lock files")); print_opt("-G", "--locking", N_("Use (vim-style) lock files"));
#endif #endif
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
if (!ISSET(RESTRICTED))
print_opt("-H", "--historylog", print_opt("-H", "--historylog",
N_("Log & read search/replace string history")); N_("Log & read search/replace string history"));
#endif #endif
#ifndef DISABLE_NANORC #ifndef DISABLE_NANORC
if (!ISSET(RESTRICTED))
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files")); print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
#endif #endif
print_opt("-K", "--rebindkeypad", print_opt("-K", "--rebindkeypad",
@ -874,11 +879,13 @@ void usage(void)
#endif #endif
print_opt("-O", "--morespace", N_("Use one more line for editing")); print_opt("-O", "--morespace", N_("Use one more line for editing"));
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
if (!ISSET(RESTRICTED))
print_opt("-P", "--positionlog", N_("Log & read location of cursor position")); print_opt("-P", "--positionlog", N_("Log & read location of cursor position"));
#endif #endif
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY
print_opt(_("-Q <str>"), _("--quotestr=<str>"), N_("Quoting string")); print_opt(_("-Q <str>"), _("--quotestr=<str>"), N_("Quoting string"));
#endif #endif
if (!ISSET(RESTRICTED))
print_opt("-R", "--restricted", N_("Restricted mode")); print_opt("-R", "--restricted", N_("Restricted mode"));
#ifndef NANO_TINY #ifndef NANO_TINY
print_opt("-S", "--smooth", N_("Scroll by line instead of half-screen")); print_opt("-S", "--smooth", N_("Scroll by line instead of half-screen"));
@ -894,6 +901,7 @@ void usage(void)
N_("Detect word boundaries more accurately")); N_("Detect word boundaries more accurately"));
#endif #endif
#ifndef DISABLE_COLOR #ifndef DISABLE_COLOR
if (!ISSET(RESTRICTED))
print_opt(_("-Y <str>"), _("--syntax=<str>"), print_opt(_("-Y <str>"), _("--syntax=<str>"),
N_("Syntax definition to use for coloring")); N_("Syntax definition to use for coloring"));
#endif #endif
@ -916,6 +924,7 @@ void usage(void)
#endif #endif
print_opt("-p", "--preserve", N_("Preserve XON (^Q) and XOFF (^S) keys")); print_opt("-p", "--preserve", N_("Preserve XON (^Q) and XOFF (^S) keys"));
#ifndef DISABLE_NANORC #ifndef DISABLE_NANORC
if (!ISSET(RESTRICTED))
print_opt("-q", "--quiet", print_opt("-q", "--quiet",
N_("Silently ignore startup issues like rc file errors")); N_("Silently ignore startup issues like rc file errors"));
#endif #endif
@ -924,6 +933,7 @@ void usage(void)
N_("Set hard-wrapping point at column #cols")); N_("Set hard-wrapping point at column #cols"));
#endif #endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
if (!ISSET(RESTRICTED))
print_opt(_("-s <prog>"), _("--speller=<prog>"), print_opt(_("-s <prog>"), _("--speller=<prog>"),
N_("Enable alternate speller")); N_("Enable alternate speller"));
#endif #endif
@ -933,6 +943,7 @@ void usage(void)
print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines")); print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines"));
#endif #endif
print_opt("-x", "--nohelp", N_("Don't show the two help lines")); print_opt("-x", "--nohelp", N_("Don't show the two help lines"));
if (!ISSET(RESTRICTED))
print_opt("-z", "--suspend", N_("Enable suspension")); print_opt("-z", "--suspend", N_("Enable suspension"));
#ifndef NANO_TINY #ifndef NANO_TINY
print_opt("-$", "--softwrap", N_("Enable soft line wrapping")); print_opt("-$", "--softwrap", N_("Enable soft line wrapping"));