commit 18dae628d2f498ce0b9aecbbfb57eeba6a8d805b
parent 891e0ec2813b94ec4d7749a4edda103351ba41a4
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 24 Apr 2006 18:54:29 +0000
reduce NO_RCFILE to a static bool in nano.c, since it's only used there
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3421 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
3 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -49,6 +49,8 @@ CVS code -
read. Changes to sc_init_one(), toggle_init(),
toggle_init_one(), shortcut_init(), get_toggle(), and
help_init(). (DLR, suggested by Benno Schulenberg)
+ - Reduce NO_RCFILE to a static bool in nano.c, since it's only
+ used there. Changes to finish() and main(). (DLR)
- files.c:
open_file()
- Remove redundant wording in the error message when we try to
diff --git a/src/nano.c b/src/nano.c
@@ -44,6 +44,10 @@
#include <setjmp.h>
#endif
+#ifdef ENABLE_NANORC
+static bool no_rcfiles = FALSE;
+ /* Should we ignore all rcfiles? */
+#endif
static struct termios oldterm;
/* The user's original terminal settings. */
static struct sigaction act;
@@ -543,7 +547,7 @@ void finish(void)
tcsetattr(0, TCSANOW, &oldterm);
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
- if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
+ if (!no_rcfiles && ISSET(HISTORYLOG))
save_history();
#endif
@@ -1726,7 +1730,7 @@ int main(int argc, char **argv)
break;
#endif
case 'I':
- SET(NO_RCFILE);
+ no_rcfiles = TRUE;
break;
#endif
case 'K':
@@ -1859,14 +1863,14 @@ int main(int argc, char **argv)
if (ISSET(RESTRICTED)) {
UNSET(SUSPEND);
UNSET(BACKUP_FILE);
- SET(NO_RCFILE);
+ no_rcfiles = TRUE;
}
/* We've read through the command line options. Now back up the flags
* and values that are set, and read the rcfile(s). If the values
* haven't changed afterward, restore the backed-up values. */
#ifdef ENABLE_NANORC
- if (!ISSET(NO_RCFILE)) {
+ if (!no_rcfiles) {
#ifndef DISABLE_OPERATINGDIR
char *operating_dir_cpy = operating_dir;
#endif
@@ -1947,7 +1951,7 @@ int main(int argc, char **argv)
/* Set up the search/replace history. */
history_init();
#ifdef ENABLE_NANORC
- if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
+ if (!no_rcfiles && ISSET(HISTORYLOG))
load_history();
#endif
#endif
diff --git a/src/nano.h b/src/nano.h
@@ -364,19 +364,18 @@ typedef struct rcoption {
#define REBIND_KEYPAD (1<<16)
#define NO_CONVERT (1<<17)
#define BACKUP_FILE (1<<18)
-#define NO_RCFILE (1<<19)
-#define NO_COLOR_SYNTAX (1<<20)
-#define PRESERVE (1<<21)
-#define HISTORYLOG (1<<22)
-#define RESTRICTED (1<<23)
-#define SMART_HOME (1<<24)
-#define WHITESPACE_DISPLAY (1<<25)
-#define MORE_SPACE (1<<26)
-#define TABS_TO_SPACES (1<<27)
-#define QUICK_BLANK (1<<28)
-#define WORD_BOUNDS (1<<29)
-#define NO_NEWLINES (1<<30)
-#define BOLD_TEXT (1<<31)
+#define NO_COLOR_SYNTAX (1<<19)
+#define PRESERVE (1<<20)
+#define HISTORYLOG (1<<21)
+#define RESTRICTED (1<<22)
+#define SMART_HOME (1<<23)
+#define WHITESPACE_DISPLAY (1<<24)
+#define MORE_SPACE (1<<25)
+#define TABS_TO_SPACES (1<<26)
+#define QUICK_BLANK (1<<27)
+#define WORD_BOUNDS (1<<28)
+#define NO_NEWLINES (1<<29)
+#define BOLD_TEXT (1<<30)
/* Control key sequences. Changing these would be very, very bad. */
#define NANO_CONTROL_SPACE 0