Adding, fixing, and removing some #endif comments.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4649 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-03-17 14:15:57 +00:00
parent a8353bdfff
commit e4c34c3386
12 changed files with 26 additions and 39 deletions

View File

@ -5,6 +5,9 @@
and newlines, condense three statements into one, place an #endif and newlines, condense three statements into one, place an #endif
better, melt two #ifndefs into one, and add a comment. better, melt two #ifndefs into one, and add a comment.
* src/winio.c (edit_scroll) - Remove the old softwrap scrolling code. * src/winio.c (edit_scroll) - Remove the old softwrap scrolling code.
* src/{nano.h,proto.h,color.c,cut.c,files.c,global.c,help.c,nano.c,
search.c,text.c,utils.c} - Add, fix, and remove some #endif comments,
remove an obsolete comment, and remove some superfluous #ifndefs.
2014-03-16 Benno Schulenberg <bensberg@justemail.net> 2014-03-16 Benno Schulenberg <bensberg@justemail.net>
* src/nano.h - Display more help items when the terminal is wider. * src/nano.h - Display more help items when the terminal is wider.

View File

@ -229,7 +229,7 @@ void color_update(void)
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "No match using extension, trying libmagic...\n"); fprintf(stderr, "No match using extension, trying libmagic...\n");
#endif /* DEBUG */ #endif
for (tmpsyntax = syntaxes; tmpsyntax != NULL; for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) { tmpsyntax = tmpsyntax->next) {
@ -241,7 +241,7 @@ void color_update(void)
} }
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr,"Matching regex \"%s\" against \"%s\"\n",e->ext_regex, magicstring); fprintf(stderr,"Matching regex \"%s\" against \"%s\"\n",e->ext_regex, magicstring);
#endif /* DEBUG */ #endif
if (magicstring && regexec(e->ext, magicstring, 0, NULL, 0) == 0) { if (magicstring && regexec(e->ext, magicstring, 0, NULL, 0) == 0) {
openfile->syntax = tmpsyntax; openfile->syntax = tmpsyntax;

View File

@ -162,7 +162,6 @@ void do_cut_text(
keep_cutbuffer = TRUE; keep_cutbuffer = TRUE;
#ifndef NANO_TINY #ifndef NANO_TINY
if (cut_till_end) { if (cut_till_end) {
/* If cut_till_end is TRUE, move all text up to the end of the /* If cut_till_end is TRUE, move all text up to the end of the
* file into the cutbuffer. */ * file into the cutbuffer. */
@ -209,14 +208,10 @@ void do_cut_text(
/* Leave the text in the cutbuffer, and mark the file as /* Leave the text in the cutbuffer, and mark the file as
* modified. */ * modified. */
#ifndef NANO_TINY
if (!copy_text) { if (!copy_text) {
#endif
set_modified(); set_modified();
#ifndef NANO_TINY
} }
#endif #endif /* !NANO_TINY */
#endif
/* Update the screen. */ /* Update the screen. */
edit_refresh_needed = TRUE; edit_refresh_needed = TRUE;
@ -254,9 +249,7 @@ void do_copy_text(void)
/* Cut from the current cursor position to the end of the file. */ /* Cut from the current cursor position to the end of the file. */
void do_cut_till_end(void) void do_cut_till_end(void)
{ {
#ifndef NANO_TINY
add_undo(CUT); add_undo(CUT);
#endif
do_cut_text(FALSE, TRUE, FALSE); do_cut_text(FALSE, TRUE, FALSE);
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */

View File

@ -211,7 +211,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "In write_lockfile(), write successful (wrote %d bytes)\n", wroteamt); fprintf(stderr, "In write_lockfile(), write successful (wrote %d bytes)\n", wroteamt);
#endif /* DEBUG */ #endif
if (fclose(filestream) == EOF) { if (fclose(filestream) == EOF) {
statusbar(_("Error writing lock file %s: %s"), statusbar(_("Error writing lock file %s: %s"),
@ -260,7 +260,7 @@ int do_lockfile(const char *filename)
locking_prefix, lockbase, locking_suffix); locking_prefix, lockbase, locking_suffix);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "lock file name is %s\n", lockfilename); fprintf(stderr, "lock file name is %s\n", lockfilename);
#endif /* DEBUG */ #endif
if (stat(lockfilename, &fileinfo) != -1) { if (stat(lockfilename, &fileinfo) != -1) {
ssize_t readtot = 0; ssize_t readtot = 0;
ssize_t readamt = 0; ssize_t readamt = 0;
@ -291,7 +291,7 @@ int do_lockfile(const char *filename)
lockprog); lockprog);
fprintf(stderr, "user which created this lock file should be %s\n", fprintf(stderr, "user which created this lock file should be %s\n",
lockuser); lockuser);
#endif /* DEBUG */ #endif
sprintf(promptstr, "File being edited (by %s, PID %d, user %s), continue?", sprintf(promptstr, "File being edited (by %s, PID %d, user %s), continue?",
lockprog, lockpid, lockuser); lockprog, lockpid, lockuser);
ans = do_yesno_prompt(FALSE, promptstr); ans = do_yesno_prompt(FALSE, promptstr);
@ -303,7 +303,7 @@ int do_lockfile(const char *filename)
return write_lockfile(lockfilename, filename, FALSE); return write_lockfile(lockfilename, filename, FALSE);
} }
#endif /* NANO_TINY */ #endif /* !NANO_TINY */
/* If it's not "", filename is a file to open. We make a new buffer, if /* If it's not "", filename is a file to open. We make a new buffer, if
@ -1626,7 +1626,7 @@ void init_backup_dir(void)
backup_dir = full_backup_dir; backup_dir = full_backup_dir;
} }
} }
#endif #endif /* !NANO_TINY */
/* Read from inn, write to out. We assume inn is opened for reading, /* Read from inn, write to out. We assume inn is opened for reading,
* and out for writing. We return 0 on success, -1 on read error, or -2 * and out for writing. We return 0 on success, -1 on read error, or -2

View File

@ -800,7 +800,7 @@ void shortcut_init(bool unjustify)
#ifndef NANO_TINY #ifndef NANO_TINY
add_to_funcs(do_research, MBROWSER, whereis_next_msg, add_to_funcs(do_research, MBROWSER, whereis_next_msg,
IFSCHELP(nano_whereis_next_msg), TRUE, VIEW); IFSCHELP(nano_whereis_next_msg), TRUE, VIEW);
#endif /* NANO_TINY */ #endif
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY
/* TRANSLATORS: Try to keep this at most 10 characters. */ /* TRANSLATORS: Try to keep this at most 10 characters. */
@ -901,7 +901,7 @@ void shortcut_init(bool unjustify)
add_to_funcs(do_redo, MMAIN, N_("Redo"), add_to_funcs(do_redo, MMAIN, N_("Redo"),
IFSCHELP(nano_redo_msg), TRUE, NOVIEW); IFSCHELP(nano_redo_msg), TRUE, NOVIEW);
} }
#endif #endif /* !NANO_TINY */
add_to_funcs(do_right, MMAIN, N_("Forward"), IFSCHELP(nano_forward_msg), add_to_funcs(do_right, MMAIN, N_("Forward"), IFSCHELP(nano_forward_msg),
FALSE, VIEW); FALSE, VIEW);
@ -1106,7 +1106,7 @@ void shortcut_init(bool unjustify)
add_to_funcs(new_buffer_void, MEXTCMD, add_to_funcs(new_buffer_void, MEXTCMD,
new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW);
#endif #endif
#endif /* NANO_TINY */ #endif /* !NANO_TINY */
#ifndef DISABLE_HELP #ifndef DISABLE_HELP
add_to_funcs(edit_refresh, MHELP, add_to_funcs(edit_refresh, MHELP,
@ -1283,7 +1283,7 @@ void shortcut_init(bool unjustify)
add_to_sclist(MMAIN, "M-N", do_toggle_void, NO_CONVERT, TRUE); add_to_sclist(MMAIN, "M-N", do_toggle_void, NO_CONVERT, TRUE);
add_to_sclist(MMAIN, "M-Z", do_toggle_void, SUSPEND, TRUE); add_to_sclist(MMAIN, "M-Z", do_toggle_void, SUSPEND, TRUE);
add_to_sclist(MMAIN, "M-$", do_toggle_void, SOFTWRAP, TRUE); add_to_sclist(MMAIN, "M-$", do_toggle_void, SOFTWRAP, TRUE);
#endif /* NANO_TINY */ #endif /* !NANO_TINY */
add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0, TRUE); add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0, TRUE);
add_to_sclist(MHELP, "^G", do_exit, 0, TRUE); add_to_sclist(MHELP, "^G", do_exit, 0, TRUE);
@ -1386,7 +1386,7 @@ const char *flagtostr(int flag)
return "?????"; return "?????";
} }
} }
#endif /* NANO_TINY */ #endif /* !NANO_TINY */
/* Interpret the string given by the rc file and return a /* Interpret the string given by the rc file and return a
* shortcut struct, complete with proper value for execute. */ * shortcut struct, complete with proper value for execute. */
@ -1550,7 +1550,7 @@ sc *strtosc(int menu, char *input)
s->execute = FALSE; s->execute = FALSE;
s->toggle = SUSPEND; s->toggle = SUSPEND;
} }
#endif /* NANO_TINY */ #endif /* !NANO_TINY */
else if (!strcasecmp(input, "right") || else if (!strcasecmp(input, "right") ||
!strcasecmp(input, "forward")) !strcasecmp(input, "forward"))
s->scfunc = do_right; s->scfunc = do_right;

View File

@ -482,7 +482,6 @@ void help_init(void)
ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n", ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n",
s->keystr, _(flagtostr(s->toggle)), _("enable/disable")); s->keystr, _(flagtostr(s->toggle)), _("enable/disable"));
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
if (old_whitespace) if (old_whitespace)
SET(WHITESPACE_DISPLAY); SET(WHITESPACE_DISPLAY);

View File

@ -1077,7 +1077,7 @@ void do_exit(void)
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(LOCKING) && openfile->lock_filename) if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename); delete_lockfile(openfile->lock_filename);
#endif /* NANO_TINY */ #endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
/* Exit only if there are no more open file buffers. */ /* Exit only if there are no more open file buffers. */
@ -2501,7 +2501,7 @@ int main(int argc, char **argv)
load_poshistory(); load_poshistory();
} }
#endif /* ENABLE_NANORC */ #endif /* ENABLE_NANORC */
#endif /* NANO_TINY */ #endif /* !NANO_TINY */
#ifndef NANO_TINY #ifndef NANO_TINY
/* Set up the backup directory (unless we're using restricted mode, /* Set up the backup directory (unless we're using restricted mode,

View File

@ -352,7 +352,7 @@ typedef struct poshiststruct {
struct poshiststruct *next; struct poshiststruct *next;
} poshiststruct; } poshiststruct;
#endif /* NANO_TINY */ #endif /* !NANO_TINY */
typedef struct openfilestruct { typedef struct openfilestruct {
@ -784,11 +784,6 @@ enum
#define UNdel_backspace (1<<1) #define UNdel_backspace (1<<1)
#define UNsplit_madenew (1<<2) #define UNsplit_madenew (1<<2)
/* Since in ISO C you can't pass around function pointers anymore,
let's make some integer macros for function names, and then I
can go cut my wrists after writing the big switch statement
that will necessitate. */
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
#define VIEW TRUE #define VIEW TRUE

View File

@ -255,7 +255,6 @@ void do_cut_text_void(void);
#ifndef NANO_TINY #ifndef NANO_TINY
void do_copy_text(void); void do_copy_text(void);
void do_cut_till_end(void); void do_cut_till_end(void);
#endif #endif
void do_uncut_text(void); void do_uncut_text(void);
@ -472,8 +471,6 @@ RETSIGTYPE do_continue(int signal);
#ifndef NANO_TINY #ifndef NANO_TINY
RETSIGTYPE handle_sigwinch(int signal); RETSIGTYPE handle_sigwinch(int signal);
void allow_pending_sigwinch(bool allow); void allow_pending_sigwinch(bool allow);
#endif
#ifndef NANO_TINY
void do_toggle(int flag); void do_toggle(int flag);
void do_toggle_void(void); void do_toggle_void(void);
#endif #endif

View File

@ -573,7 +573,7 @@ void do_research(void)
openfile->current_x && !didfind) openfile->current_x && !didfind)
statusbar(_("This is the only occurrence")); statusbar(_("This is the only occurrence"));
} else { } else {
#endif #endif /* HAVE_REGEX_H */
statusbar(_("This is the only occurrence")); statusbar(_("This is the only occurrence"));
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
} }
@ -586,7 +586,7 @@ void do_research(void)
edit_redraw(fileptr, pww_save); edit_redraw(fileptr, pww_save);
search_replace_abort(); search_replace_abort();
} }
#endif #endif /* !NANO_TINY */
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
int replace_regexp(char *string, bool create) int replace_regexp(char *string, bool create)
@ -636,7 +636,7 @@ int replace_regexp(char *string, bool create)
return new_line_size; return new_line_size;
} }
#endif #endif /* HAVE_REGEX_H */
char *replace_line(const char *needle) char *replace_line(const char *needle)
{ {
@ -724,7 +724,7 @@ ssize_t do_replace_loop(
#endif #endif
edit_refresh(); edit_refresh();
} }
#endif #endif /* !NANO_TINY */
if (canceled != NULL) if (canceled != NULL)
*canceled = FALSE; *canceled = FALSE;

View File

@ -3228,7 +3228,7 @@ void do_linter(void)
openfile = tmpof; openfile = tmpof;
} }
} }
#endif /* NANO_TINY */ #endif /* !NANO_TINY */
do_gotolinecolumn(curlint->lineno, tmpcol, FALSE, FALSE, FALSE, FALSE); do_gotolinecolumn(curlint->lineno, tmpcol, FALSE, FALSE, FALSE, FALSE);
titlebar(NULL); titlebar(NULL);
edit_refresh(); edit_refresh();

View File

@ -598,7 +598,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
*right_side_up = FALSE; *right_side_up = FALSE;
} }
} }
#endif #endif /* !NANO_TINY */
/* Calculate the number of characters between begin and end, and return /* Calculate the number of characters between begin and end, and return
* it. */ * it. */