From: David Lawrence Ramsey Date: Mon, 24 Apr 2006 18:54:29 +0000 (+0000) Subject: reduce NO_RCFILE to a static bool in nano.c, since it's only used there X-Git-Tag: v1.3.12~257 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=18dae628d2f498ce0b9aecbbfb57eeba6a8d805b;p=nano.git 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 --- diff --git a/ChangeLog b/ChangeLog index ae8cdb1c..ce0048ca 100644 --- 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 index dcd906ab..b6142fca 100644 --- a/src/nano.c +++ b/src/nano.c @@ -44,6 +44,10 @@ #include #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 index b3a87c6c..788504be 100644 --- 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