commit ab53864de75de2981aac8a39971319fdc3de998b
parent 8deebeb904a395dc7fd859dbe532ed4f0747e707
Author: Chris Allegretta <chrisa@asty.org>
Date: Fri, 12 Nov 2010 06:22:12 +0000
2010-11-12 Chris Allegretta <chrisa@asty.org>
* Add check for RESTRICTED mode back to speller, suspend and insert file
routines, since adding key bindings broke the fact that they should be
disabled in restricted mode. Fixes Savannah bug 31625 reported by
Charlie Somerville.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4519 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
5 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-12 Chris Allegretta <chrisa@asty.org>
+ * Add check for RESTRICTED mode back to speller, suspend and insert file
+ routines, since adding key bindings broke the fact that they should be
+ disabled in restricted mode. Fixes Savannah bug 31625 reported by
+ Charlie Somerville.
+
GNU nano 2.2.5 - 2010.08.05
2010-08-04 Lauri Kasanen <curaga@operamail.comcuraga@operamail.com>
* doc/syntax/mgp.nanorc: New Magicpoint syntax highlighting definition
diff --git a/src/files.c b/src/files.c
@@ -1066,6 +1066,12 @@ void do_insertfile(
* allow inserting a file into a new buffer. */
void do_insertfile_void(void)
{
+
+ if (ISSET(RESTRICTED)) {
+ nano_disabled_msg();
+ return;
+ }
+
#ifdef ENABLE_MULTIBUFFER
if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER))
statusbar(_("Key invalid in non-multibuffer mode"));
diff --git a/src/global.c b/src/global.c
@@ -690,7 +690,8 @@ void shortcut_init(bool unjustify)
* restricted mode, inserting files is disabled, since it allows
* reading from or writing to files not specified on the command
* line. */
- add_to_funcs(!ISSET(RESTRICTED) ? DO_INSERTFILE_VOID : NANO_DISABLED_MSG,
+
+ add_to_funcs(DO_INSERTFILE_VOID,
/* TRANSLATORS: Try to keep this at most 10 characters. */
MMAIN, N_("Read File"), IFSCHELP(nano_insert_msg), FALSE,
#ifdef ENABLE_MULTIBUFFER
@@ -732,10 +733,9 @@ void shortcut_init(bool unjustify)
* because it allows reading from or writing to files not specified
* on the command line. */
#ifndef DISABLE_SPELLER
- if (!ISSET(RESTRICTED))
- /* TRANSLATORS: Try to keep this at most 10 characters. */
- add_to_funcs(DO_SPELL, MMAIN, N_("To Spell"), IFSCHELP(nano_spell_msg),
- TRUE, NOVIEW);
+ /* TRANSLATORS: Try to keep this at most 10 characters. */
+ add_to_funcs(DO_SPELL, MMAIN, N_("To Spell"), IFSCHELP(nano_spell_msg),
+ TRUE, NOVIEW);
#endif
add_to_funcs(DO_FIRST_LINE,
diff --git a/src/nano.c b/src/nano.c
@@ -1185,6 +1185,12 @@ RETSIGTYPE handle_hupterm(int signal)
/* Handler for SIGTSTP (suspend). */
RETSIGTYPE do_suspend(int signal)
{
+
+ if (ISSET(RESTRICTED)) {
+ nano_disabled_msg();
+ return;
+ }
+
#ifndef DISABLE_MOUSE
/* Turn mouse support off. */
disable_mouse_support();
@@ -1212,7 +1218,7 @@ RETSIGTYPE do_suspend(int signal)
}
/* the subnfunc version */
-void do_suspend_void(void)
+void do_suspend_void(void)
{
if (ISSET(SUSPEND))
do_suspend(0);
diff --git a/src/text.c b/src/text.c
@@ -2920,6 +2920,11 @@ void do_spell(void)
char *temp = safe_tempfile(&temp_file);
const char *spell_msg;
+ if (ISSET(RESTRICTED)) {
+ nano_disabled_msg();
+ return;
+ }
+
if (temp == NULL) {
statusbar(_("Error writing temp file: %s"), strerror(errno));
return;