Commit edab0cc0 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

a few cleanups and consistency fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1837 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 27 additions and 19 deletions
+27 -19
...@@ -10,6 +10,10 @@ CVS code - ...@@ -10,6 +10,10 @@ CVS code -
those functions are essentially unused. Changes to those functions are essentially unused. Changes to
sc_init_one(), shortcut_init(), etc. (David Benbennick and sc_init_one(), shortcut_init(), etc. (David Benbennick and
DLR) DLR)
- Make flags and all variables meant to store the value of flags
longs for consistency. (David Benbennick)
- Rename the TEMP_OPT flags to TEMP_FILE, as it's more
descriptive. (DLR)
- files.c: - files.c:
close_open_file() close_open_file()
- Tweak to no longer rely on the return values of - Tweak to no longer rely on the return values of
...@@ -25,10 +29,14 @@ CVS code - ...@@ -25,10 +29,14 @@ CVS code -
- Change the last variables in the prototypes for do_justify() - Change the last variables in the prototypes for do_justify()
and get_mouseinput() to match the ones used in the actual and get_mouseinput() to match the ones used in the actual
functions. (DLR) functions. (DLR)
- Remove unused declaration of temp_opt. (David Benbennick)
- rcfile.c: - rcfile.c:
parse_rcfile() parse_rcfile()
- Have whitespace display default to off instead of on. (Mike - Have whitespace display default to off instead of on. (Mike
Frysinger) Frysinger)
nregcomp()
- Rename the variable flags to eflags so as not to conflict with
the global flags. (DLR)
- winio.c: - winio.c:
get_control_kbinput() get_control_kbinput()
- Fix erroneous debugging statement so that nano compiles with - Fix erroneous debugging statement so that nano compiles with
......
...@@ -1794,7 +1794,7 @@ int do_writeout(int exiting) ...@@ -1794,7 +1794,7 @@ int do_writeout(int exiting)
currshortcut = writefile_list; currshortcut = writefile_list;
#endif #endif
if (exiting && filename[0] != '\0' && ISSET(TEMP_OPT)) { if (exiting && filename[0] != '\0' && ISSET(TEMP_FILE)) {
i = write_file(filename, FALSE, 0, FALSE); i = write_file(filename, FALSE, 0, FALSE);
if (i == 1) { if (i == 1) {
/* Write succeeded. */ /* Write succeeded. */
...@@ -1901,7 +1901,7 @@ int do_writeout(int exiting) ...@@ -1901,7 +1901,7 @@ int do_writeout(int exiting)
#endif #endif
#ifdef NANO_EXTRA #ifdef NANO_EXTRA
if (exiting && !ISSET(TEMP_OPT) && !strcasecmp(answer, "zzy") if (exiting && !ISSET(TEMP_FILE) && !strcasecmp(answer, "zzy")
&& !did_cred) { && !did_cred) {
do_credits(); do_credits();
did_cred = TRUE; did_cred = TRUE;
......
...@@ -39,7 +39,7 @@ char *last_replace = NULL; /* Last replacement string */ ...@@ -39,7 +39,7 @@ char *last_replace = NULL; /* Last replacement string */
int search_last_line; /* Is this the last search line? */ int search_last_line; /* Is this the last search line? */
int search_offscreen; /* Search lines not displayed */ int search_offscreen; /* Search lines not displayed */
int flags = 0; /* Our new flag containing many options */ long flags = 0; /* Our flag containing many options */
WINDOW *edit; /* The file portion of the editor */ WINDOW *edit; /* The file portion of the editor */
WINDOW *topwin; /* Top line of screen */ WINDOW *topwin; /* Top line of screen */
WINDOW *bottomwin; /* Bottom buffer */ WINDOW *bottomwin; /* Bottom buffer */
......
...@@ -2387,7 +2387,7 @@ void do_justify(int full_justify) ...@@ -2387,7 +2387,7 @@ void do_justify(int full_justify)
* unjustifies. Note we don't need to save totlines. */ * unjustifies. Note we don't need to save totlines. */
int current_x_save = current_x; int current_x_save = current_x;
int current_y_save = current_y; int current_y_save = current_y;
int flags_save = flags; long flags_save = flags;
long totsize_save = totsize; long totsize_save = totsize;
filestruct *current_save = current; filestruct *current_save = current;
filestruct *edittop_save = edittop; filestruct *edittop_save = edittop;
...@@ -2715,7 +2715,7 @@ void do_exit(void) ...@@ -2715,7 +2715,7 @@ void do_exit(void)
if (!ISSET(MODIFIED)) if (!ISSET(MODIFIED))
i = 0; /* Pretend the user chose not to save. */ i = 0; /* Pretend the user chose not to save. */
else if (ISSET(TEMP_OPT)) else if (ISSET(TEMP_FILE))
i = 1; i = 1;
else else
i = do_yesno(FALSE, i = do_yesno(FALSE,
...@@ -3234,7 +3234,7 @@ int main(int argc, char *argv[]) ...@@ -3234,7 +3234,7 @@ int main(int argc, char *argv[])
break; break;
#endif #endif
case 't': case 't':
SET(TEMP_OPT); SET(TEMP_FILE);
break; break;
case 'v': case 'v':
SET(VIEW_MODE); SET(VIEW_MODE);
......
...@@ -264,7 +264,7 @@ typedef struct historyheadtype { ...@@ -264,7 +264,7 @@ typedef struct historyheadtype {
#define VIEW_MODE (1<<9) #define VIEW_MODE (1<<9)
#define USE_MOUSE (1<<10) #define USE_MOUSE (1<<10)
#define USE_REGEXP (1<<11) #define USE_REGEXP (1<<11)
#define TEMP_OPT (1<<12) #define TEMP_FILE (1<<12)
#define CUT_TO_END (1<<13) #define CUT_TO_END (1<<13)
#define REVERSE_SEARCH (1<<14) #define REVERSE_SEARCH (1<<14)
#define MULTIBUFFER (1<<15) #define MULTIBUFFER (1<<15)
......
...@@ -39,8 +39,7 @@ extern int placewewant; ...@@ -39,8 +39,7 @@ extern int placewewant;
extern int mark_beginx; extern int mark_beginx;
#endif #endif
extern long totsize; extern long totsize;
extern int temp_opt; extern long flags;
extern int flags;
extern int tabsize; extern int tabsize;
extern int search_last_line; extern int search_last_line;
extern int search_offscreen; extern int search_offscreen;
...@@ -370,7 +369,7 @@ char *parse_argument(char *ptr); ...@@ -370,7 +369,7 @@ char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
int colortoint(const char *colorname, int *bright); int colortoint(const char *colorname, int *bright);
char *parse_next_regex(char *ptr); char *parse_next_regex(char *ptr);
int nregcomp(regex_t *preg, const char *regex, int flags); int nregcomp(regex_t *preg, const char *regex, int eflags);
void parse_syntax(char *ptr); void parse_syntax(char *ptr);
void parse_colors(char *ptr); void parse_colors(char *ptr);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
......
...@@ -92,7 +92,7 @@ const static rcoption rcopts[] = { ...@@ -92,7 +92,7 @@ const static rcoption rcopts[] = {
#endif #endif
{"suspend", SUSPEND}, {"suspend", SUSPEND},
{"tabsize", 0}, {"tabsize", 0},
{"tempfile", TEMP_OPT}, {"tempfile", TEMP_FILE},
{"view", VIEW_MODE}, {"view", VIEW_MODE},
#ifndef NANO_SMALL #ifndef NANO_SMALL
{"whitespace", 0}, {"whitespace", 0},
...@@ -253,11 +253,11 @@ char *parse_next_regex(char *ptr) ...@@ -253,11 +253,11 @@ char *parse_next_regex(char *ptr)
return ptr; return ptr;
} }
/* Compile the regular expression regex to preg. Returns FALSE on success, /* Compile the regular expression regex to preg. Returns FALSE on
TRUE if the expression is invalid. */ * success, or TRUE if the expression is invalid. */
int nregcomp(regex_t *preg, const char *regex, int flags) int nregcomp(regex_t *preg, const char *regex, int eflags)
{ {
int rc = regcomp(preg, regex, REG_EXTENDED | flags); int rc = regcomp(preg, regex, REG_EXTENDED | eflags);
if (rc != 0) { if (rc != 0) {
size_t len = regerror(rc, preg, NULL, 0); size_t len = regerror(rc, preg, NULL, 0);
......
...@@ -899,7 +899,8 @@ void do_find_bracket(void) ...@@ -899,7 +899,8 @@ void do_find_bracket(void)
char ch_under_cursor, wanted_ch; char ch_under_cursor, wanted_ch;
const char *pos, *brackets = "([{<>}])"; const char *pos, *brackets = "([{<>}])";
char regexp_pat[] = "[ ]"; char regexp_pat[] = "[ ]";
int old_pww = placewewant, current_x_save, flagsave, count = 1; int old_pww = placewewant, current_x_save, count = 1;
long flags_save;
filestruct *current_save; filestruct *current_save;
ch_under_cursor = current->data[current_x]; ch_under_cursor = current->data[current_x];
...@@ -915,7 +916,7 @@ void do_find_bracket(void) ...@@ -915,7 +916,7 @@ void do_find_bracket(void)
current_x_save = current_x; current_x_save = current_x;
current_save = current; current_save = current;
flagsave = flags; flags_save = flags;
SET(USE_REGEXP); SET(USE_REGEXP);
/* Apparent near redundancy with regexp_pat[] here is needed. /* Apparent near redundancy with regexp_pat[] here is needed.
...@@ -958,7 +959,7 @@ void do_find_bracket(void) ...@@ -958,7 +959,7 @@ void do_find_bracket(void)
} }
regexp_cleanup(); regexp_cleanup();
flags = flagsave; flags = flags_save;
} }
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment