]> git.wh0rd.org Git - nano.git/commitdiff
Not showing options that don't have any effect when asking for --help in
authorBenno Schulenberg <bensberg@justemail.net>
Wed, 29 Jul 2015 19:31:50 +0000 (19:31 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Wed, 29 Jul 2015 19:31:50 +0000 (19:31 +0000)
restricted mode.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5327 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/nano.c

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