FALSE. (David Benbennick and DLR)
- Change more instances of ints that can never be negative to
size_t's. (DLR)
+ - Convert the shortcut list functions and most related functions
+ to return void instead of int, as the return values of all
+ those functions are essentially unused. Changes to
+ sc_init_one(), shortcut_init(), etc. (David Benbennick and
+ DLR)
+- files.c:
+ close_open_file()
+ - Tweak to no longer rely on the return values of
+ open_(prev|next)file(). (DLR)
- global.c:
shortcut_init()
- Fix erroneous #ifdef so that nano compiles with
--disable-justify again. (DLR; found by Mike Frysinger)
+- nano.c:
+ do_exit()
+ - Tweak for efficiency. (David Benbennick)
- proto.h:
- - Change the last variable in the prototype for get_mouseinput()
- to match the one used in the actual function. (DLR)
+ - Change the last variables in the prototypes for do_justify()
+ and get_mouseinput() to match the ones used in the actual
+ functions. (DLR)
- rcfile.c:
parse_rcfile()
- Have whitespace display default to off instead of on. (Mike
}
#endif
-int do_cut_text(void)
+void do_cut_text(void)
{
filestruct *fileptr;
&& !ISSET(MARK_ISSET)
#endif
)
- return 0;
+ return;
keep_cutbuffer = TRUE;
do_delete();
marked_cut = 2;
- return 1;
+ return;
} else {
SET(MARK_ISSET);
marked_cut = 1;
edit_refresh();
set_modified();
-
- return 1;
+ return;
}
#endif /* !NANO_SMALL */
#ifndef NANO_SMALL
concatenate_cut = FALSE;
#endif
- return 1;
}
-int do_uncut_text(void)
+void do_uncut_text(void)
{
filestruct *tmp = current;
filestruct *newbuf = NULL;
#endif
check_statblank();
if (cutbuffer == NULL || current == NULL)
- return 0; /* AIEEEEEEEEEEEE */
+ return; /* AIEEEEEEEEEEEE */
/* If we're uncutting a previously non-marked block, uncut to end if
* we're not at the beginning of the line. If we are at the
current = newend;
}
- /* If marked cut == 2, that means that we're doing a cut to end
+ /* If marked cut == 2, it means that we're doing a cut to end
* and we don't want anything else on the line, so we have to
- * screw up all the work we just did and separate the line.
- * There must be a better way to do this, but not at 1 AM on a
- * work night. */
+ * screw up all the work we just did and separate the line. */
if (marked_cut == 2) {
tmp = make_new_node(current);
tmp->data = mallocstrcpy(NULL, current->data + current_x);
#endif
set_modified();
edit_refresh();
- return 0;
+ return;
}
if (current != fileage) {
#endif
set_modified();
- return 1;
}
on the command line, a new file will be created, but it will be
given no open_files entry */
if (open_files == NULL) {
- add_open_file(0);
+ add_open_file(FALSE);
/* turn off view mode in this case; this is for consistency
whether multibuffers are compiled in or not */
UNSET(VIEW_MODE);
return buf;
}
-int do_insertfile(int loading_file)
+void do_insertfile(int loading_file)
{
int i, old_current_x = current_x;
char *realname = NULL;
if (ts == -1 || answer == NULL || answer[0] == '\0') {
statusbar(_("Cancelled"));
display_main_list();
- return 0;
+ return;
}
}
#endif /* !NANO_SMALL */
#ifndef NANO_SMALL
i != NANO_EXTCMD_KEY &&
#endif
- check_operating_dir(answer, 0) != 0) {
+ check_operating_dir(answer, FALSE) != 0) {
statusbar(_("Can't insert file from outside of %s"),
operating_dir);
- return 0;
+ return;
}
#endif
#ifdef ENABLE_MULTIBUFFER
if (loading_file) {
/* update the current entry in the open_files structure */
- add_open_file(1);
+ add_open_file(TRUE);
new_file();
UNSET(MODIFIED);
#ifndef NANO_SMALL
#ifdef ENABLE_MULTIBUFFER
if (loading_file)
- load_file(0);
+ load_file(FALSE);
else
#endif
set_modified();
inspath = NULL;
display_main_list();
- return i;
}
-int do_insertfile_void(void)
+void do_insertfile_void(void)
{
- int result = 0;
#ifdef ENABLE_MULTIBUFFER
if (ISSET(VIEW_MODE)) {
if (ISSET(MULTIBUFFER))
- result = do_insertfile(1);
+ do_insertfile(TRUE);
else
statusbar(_("Key illegal in non-multibuffer mode"));
}
else
- result = do_insertfile(ISSET(MULTIBUFFER));
+ do_insertfile(ISSET(MULTIBUFFER));
#else
- result = do_insertfile(0);
+ do_insertfile(FALSE);
#endif
display_main_list();
- return result;
}
#ifdef ENABLE_MULTIBUFFER
/*
* Add/update an entry to the open_files openfilestruct. If update is
- * zero, a new entry is created; otherwise, the current entry is updated.
- * Return 0 on success or 1 on error.
+ * FALSE, a new entry is created; otherwise, the current entry is
+ * updated.
*/
-int add_open_file(int update)
+void add_open_file(int update)
{
openfilestruct *tmp;
if (fileage == NULL || current == NULL || filename == NULL)
- return 1;
+ return;
/* if no entries, make the first one */
if (open_files == NULL)
#ifdef DEBUG
fprintf(stderr, "filename is %s\n", open_files->filename);
#endif
-
- return 0;
}
/*
* Read the current entry in the open_files structure and set up the
- * currently open file using that entry's information. Return 0 on
- * success or 1 on error.
+ * currently open file using that entry's information.
*/
-int load_open_file(void)
+void load_open_file(void)
{
if (open_files == NULL)
- return 1;
+ return;
/* set up the filename, the file buffer, the total number of lines in
the file, and the total file size */
/* update the titlebar */
clearok(topwin, FALSE);
titlebar(NULL);
-
- /* now we're done */
- return 0;
}
/*
* Open the previous entry in the open_files structure. If closing_file
- * is zero, update the current entry before switching from it.
- * Otherwise, we are about to close that entry, so don't bother doing so.
- * Return 0 on success and 1 on error.
+ * is FALSE, update the current entry before switching from it.
+ * Otherwise, we are about to close that entry, so don't bother doing
+ * so.
*/
-int open_prevfile(int closing_file)
+void open_prevfile(int closing_file)
{
if (open_files == NULL)
- return 1;
+ return;
/* if we're not about to close the current entry, update it before
doing anything */
if (!closing_file)
- add_open_file(1);
+ add_open_file(TRUE);
if (open_files->prev == NULL && open_files->next == NULL) {
/* only one file open */
if (!closing_file)
statusbar(_("No more open file buffers"));
- return 1;
+ return;
}
if (open_files->prev != NULL) {
load_open_file();
statusbar(_("Switched to %s"),
- ((open_files->filename[0] == '\0') ? "New Buffer" : open_files->filename));
+ ((open_files->filename[0] == '\0') ? "New Buffer" :
+ open_files->filename));
#ifdef DEBUG
dump_buffer(current);
#endif
-
- return 0;
}
-/* This function is used by the shortcut list. */
-int open_prevfile_void(void)
+void open_prevfile_void(void)
{
- return open_prevfile(0);
+ open_prevfile(FALSE);
}
/*
* Open the next entry in the open_files structure. If closing_file is
- * zero, update the current entry before switching from it. Otherwise, we
- * are about to close that entry, so don't bother doing so. Return 0 on
- * success and 1 on error.
+ * FALSE, update the current entry before switching from it. Otherwise,
+ * we are about to close that entry, so don't bother doing so.
*/
-int open_nextfile(int closing_file)
+void open_nextfile(int closing_file)
{
if (open_files == NULL)
- return 1;
+ return;
/* if we're not about to close the current entry, update it before
doing anything */
if (!closing_file)
- add_open_file(1);
+ add_open_file(TRUE);
if (open_files->prev == NULL && open_files->next == NULL) {
/* only one file open */
if (!closing_file)
statusbar(_("No more open file buffers"));
- return 1;
+ return;
}
if (open_files->next != NULL) {
load_open_file();
statusbar(_("Switched to %s"),
- ((open_files->filename[0] == '\0') ? "New Buffer" : open_files->filename));
+ ((open_files->filename[0] == '\0') ? "New Buffer" :
+ open_files->filename));
#ifdef DEBUG
dump_buffer(current);
#endif
-
- return 0;
}
-/* This function is used by the shortcut list. */
-int open_nextfile_void(void)
+void open_nextfile_void(void)
{
- return open_nextfile(0);
+ open_nextfile(FALSE);
}
/*
open_files->filebot = filebot;
tmp = open_files;
- if (open_nextfile(1)) {
- if (open_prevfile(1))
- return 1;
- }
+ if (open_files->next != NULL)
+ open_nextfile(TRUE);
+ else if (open_files->prev != NULL)
+ open_prevfile(TRUE);
+ else
+ return 1;
unlink_opennode(tmp);
delete_opennode(tmp);
#ifndef DISABLE_OPERATINGDIR
/* If we're writing a temporary file, we're probably going outside
* the operating directory, so skip the operating directory test. */
- if (!tmp && check_operating_dir(realname, 0) != 0) {
+ if (!tmp && check_operating_dir(realname, FALSE) != 0) {
statusbar(_("Can't write outside of %s"), operating_dir);
goto cleanup_and_exit;
}
/* If we're not about to exit, update the current entry in
* the open_files structure. */
if (!exiting)
- add_open_file(1);
+ add_open_file(TRUE);
#endif
display_main_list();
return i;
} /* while (TRUE) */
}
-int do_writeout_void(void)
+void do_writeout_void(void)
{
- return do_writeout(FALSE);
+ do_writeout(FALSE);
}
/* Return a malloc()ed string containing the actual directory, used
directory, in which case just go to the next match */
if (operating_dir != NULL) {
- if (check_operating_dir(userdata->pw_dir, 1) != 0)
+ if (check_operating_dir(userdata->pw_dir, TRUE) != 0)
continue;
}
#endif
strcpy(tmp2, dirname);
strcat(tmp2, "/");
strcat(tmp2, next->d_name);
- if (check_operating_dir(tmp2, 1) != 0) {
+ if (check_operating_dir(tmp2, TRUE) != 0) {
free(tmp2);
continue;
}
/* Note: the selected file can be outside the operating
* directory if it is .. or if it is a symlink to
* directory outside the operating directory. */
- if (check_operating_dir(filelist[selected], 0) != 0) {
+ if (check_operating_dir(filelist[selected], FALSE) != 0) {
statusbar(_("Can't go outside of %s in restricted mode"), operating_dir);
beep();
break;
}
#ifndef DISABLE_OPERATINGDIR
- if (check_operating_dir(new_path, 0) != 0) {
+ if (check_operating_dir(new_path, FALSE) != 0) {
statusbar(_("Can't go outside of %s in restricted mode"), operating_dir);
free(new_path);
break;
#ifndef DISABLE_OPERATINGDIR
/* If the resulting path isn't in the operating directory, use that. */
- if (check_operating_dir(path, 0) != 0)
+ if (check_operating_dir(path, FALSE) != 0)
path = mallocstrcpy(path, operating_dir);
#endif
#ifndef DISABLE_HELP
const char *help,
#endif
- int metaval, int funcval, int miscval, int view, int
+ int metaval, int funcval, int miscval, int view, void
(*func)(void))
{
shortcut *s;
#include "proto.h"
#include "nano.h"
-int do_first_line(void)
+void do_first_line(void)
{
int old_pww = placewewant;
current = fileage;
current_x = 0;
if (edittop != fileage || need_vertical_update(old_pww))
edit_update(current, TOP);
- return 1;
}
-int do_last_line(void)
+void do_last_line(void)
{
int old_pww = placewewant;
current = filebot;
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
need_vertical_update(old_pww))
edit_update(current, CENTER);
- return 1;
}
-int do_home(void)
+void do_home(void)
{
int old_pww = placewewant;
#ifndef NANO_SMALL
check_statblank();
if (need_horizontal_update(old_pww))
update_line(current, current_x);
- return 1;
}
-int do_end(void)
+void do_end(void)
{
int old_pww = placewewant;
current_x = strlen(current->data);
check_statblank();
if (need_horizontal_update(old_pww))
update_line(current, current_x);
- return 1;
}
-int do_page_up(void)
+void do_page_up(void)
{
int old_pww = placewewant;
const filestruct *old_current = current;
edit_redraw(old_current, old_pww);
check_statblank();
- return 1;
}
-int do_page_down(void)
+void do_page_down(void)
{
int old_pww = placewewant;
const filestruct *old_current = current;
edit_redraw(old_current, old_pww);
check_statblank();
- return 1;
}
-int do_up(void)
+void do_up(void)
{
#ifndef DISABLE_WRAPPING
wrap_reset();
check_statblank();
if (current->prev == NULL)
- return 0;
+ return;
assert(current_y == current->lineno - edittop->lineno);
current = current->prev;
if (need_vertical_update(0))
update_line(current->next, 0);
update_line(current, current_x);
-
- return 1;
}
-/* Return value 1 means we moved down, 0 means we were already at the
- * bottom. */
-int do_down(void)
+void do_down(void)
{
#ifndef DISABLE_WRAPPING
wrap_reset();
check_statblank();
if (current->next == NULL)
- return 0;
+ return;
assert(current_y == current->lineno - edittop->lineno);
current = current->next;
if (need_vertical_update(0))
update_line(current->prev, 0);
update_line(current, current_x);
-
- return 1;
}
-int do_left(int allow_update)
+void do_left(int allow_update)
{
int old_pww = placewewant;
if (current_x > 0)
check_statblank();
if (allow_update && need_horizontal_update(old_pww))
update_line(current, current_x);
- return 1;
}
-int do_left_void(void)
+void do_left_void(void)
{
- return do_left(TRUE);
+ do_left(TRUE);
}
-int do_right(int allow_update)
+void do_right(int allow_update)
{
int old_pww = placewewant;
assert(current_x <= strlen(current->data));
check_statblank();
if (allow_update && need_horizontal_update(old_pww))
update_line(current, current_x);
- return 1;
}
-int do_right_void(void)
+void do_right_void(void)
{
- return do_right(TRUE);
+ do_right(TRUE);
}
return ISSET(NO_HELP) ? 2 : 0;
}
-int nano_disabled_msg(void)
+void nano_disabled_msg(void)
{
statusbar(_("Sorry, support for this function has been disabled"));
- return 1;
}
#ifndef NANO_SMALL
update_line(current, current_x);
}
-int do_verbatim_input(void)
+void do_verbatim_input(void)
{
int *v_kbinput = NULL; /* Used to hold verbatim input. */
size_t v_len; /* Length of verbatim input. */
UNSET(DISABLE_CURPOS);
free(v_kbinput);
-
- return 1;
}
-int do_backspace(void)
+void do_backspace(void)
{
if (current != fileage || current_x > 0) {
do_left(FALSE);
do_delete();
}
- return 1;
}
-int do_delete(void)
+void do_delete(void)
{
int do_refresh = FALSE;
/* Do we have to call edit_refresh(), or can we get away with
totlines--;
wrap_reset();
} else
- return 0;
+ return;
totsize--;
set_modified();
edit_refresh();
else
update_line(current, current_x);
-
- return 1;
}
-int do_tab(void)
+void do_tab(void)
{
do_char('\t');
- return 1;
}
/* Someone hits return *gasp!* */
-int do_enter(void)
+void do_enter(void)
{
filestruct *newnode = make_new_node(current);
size_t extra = 0;
totlines++;
set_modified();
placewewant = xplustabs();
-
- return 1;
}
#ifndef NANO_SMALL
-int do_next_word(void)
+void do_next_word(void)
{
int old_pww = placewewant;
const filestruct *current_save = current;
/* Refresh the screen. If current has run off the bottom, this
* call puts it at the center line. */
edit_redraw(current_save, old_pww);
-
- return 0;
}
/* The same thing for backwards. */
-int do_prev_word(void)
+void do_prev_word(void)
{
int old_pww = placewewant;
const filestruct *current_save = current;
/* Refresh the screen. If current has run off the top, this call
* puts it at the center line. */
edit_redraw(current_save, old_pww);
-
- return 0;
}
-int do_mark(void)
+void do_mark(void)
{
TOGGLE(MARK_ISSET);
if (ISSET(MARK_ISSET)) {
statusbar(_("Mark UNset"));
edit_refresh();
}
- return 1;
}
#endif /* !NANO_SMALL */
return NULL;
}
-int do_spell(void)
+void do_spell(void)
{
int i;
char *temp = safe_tempnam(0, "nano.");
if (temp == NULL) {
statusbar(_("Could not create temp file: %s"), strerror(errno));
- return 0;
+ return;
}
#ifndef NANO_SMALL
if (i == -1) {
statusbar(_("Unable to write temp file: %s"), strerror(errno));
free(temp);
- return 0;
+ return;
}
#ifdef ENABLE_MULTIBUFFER
/* Update the current open_files entry before spell-checking, in
* case any problems occur. */
- add_open_file(1);
+ add_open_file(TRUE);
#endif
spell_msg = alt_speller != NULL ? do_alt_speller(temp) :
if (spell_msg != NULL) {
statusbar(_("Spell checking failed: %s: %s"), spell_msg,
strerror(errno));
- return 0;
+ return;
} else
statusbar(_("Finished checking spelling"));
-
- return 1;
}
#endif /* !DISABLE_SPELLER */
return 0;
}
-int do_para_begin(void)
+void do_para_begin(void)
{
- return do_para_search(BEGIN, NULL, NULL, NULL, TRUE);
+ do_para_search(BEGIN, NULL, NULL, NULL, TRUE);
}
-int do_para_end(void)
+void do_para_end(void)
{
- return do_para_search(END, NULL, NULL, NULL, TRUE);
+ do_para_search(END, NULL, NULL, NULL, TRUE);
}
/* If full_justify is TRUE, justify the entire file. Otherwise, justify
* the current paragraph. */
-int do_justify(int full_justify)
+void do_justify(int full_justify)
{
size_t quote_len;
/* Length of the initial quotation of the paragraph we
break;
} else {
edit_refresh();
- return 0;
+ return;
}
}
/* Display the shortcut list with UnCut. */
shortcut_init(FALSE);
display_main_list();
-
- return 0;
}
-int do_justify_void(void)
+void do_justify_void(void)
{
- return do_justify(FALSE);
+ do_justify(FALSE);
}
-int do_full_justify(void)
+void do_full_justify(void)
{
- return do_justify(TRUE);
+ do_justify(TRUE);
}
#endif /* !DISABLE_JUSTIFY */
-int do_exit(void)
+void do_exit(void)
{
int i;
- if (!ISSET(MODIFIED)) {
-
-#ifdef ENABLE_MULTIBUFFER
- if (!close_open_file()) {
- display_main_list();
- return 1;
- }
- else
-#endif
- finish();
- }
-
- if (ISSET(TEMP_OPT))
+ if (!ISSET(MODIFIED))
+ i = 0; /* Pretend the user chose not to save. */
+ else if (ISSET(TEMP_OPT))
i = 1;
else
- i = do_yesno(FALSE, _("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "));
-
+ i = do_yesno(FALSE,
+ _("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "));
+
#ifdef DEBUG
dump_buffer(fileage);
#endif
- if (i == 1) {
- if (do_writeout(TRUE) > 0) {
-
+ if (i == 0 || (i == 1 && do_writeout(TRUE) > 0)) {
#ifdef ENABLE_MULTIBUFFER
- if (!close_open_file()) {
- display_main_list();
- return 1;
- }
- else
-#endif
- finish();
- }
- } else if (i == 0) {
-
-#ifdef ENABLE_MULTIBUFFER
- if (!close_open_file()) {
- display_main_list();
- return 1;
- }
- else
+ /* Exit only if there are no more open buffers. */
+ if (close_open_file() != 0)
#endif
finish();
- } else
+ } else if (i != 1)
statusbar(_("Cancelled"));
display_main_list();
- return 1;
}
void signal_init(void)
int old_multibuffer = ISSET(MULTIBUFFER);
SET(MULTIBUFFER);
for (optind++; optind < argc; optind++) {
- add_open_file(1);
+ add_open_file(TRUE);
new_file();
filename = mallocstrcpy(filename, argv[optind]);
open_file(filename, 0, 0);
- load_file(0);
+ load_file(FALSE);
}
open_nextfile_void();
if (!old_multibuffer)
int funcval; /* Function key we want bound. */
int miscval; /* Other Meta key we want bound. */
int viewok; /* Is this function legal in view mode? */
- int (*func) (void); /* Function to call when we catch this key. */
+ void (*func)(void); /* Function to call when we catch this key. */
const char *desc; /* Description, e.g. "Page Up". */
#ifndef DISABLE_HELP
const char *help; /* Help file entry text. */
filestruct *get_cutbottom(void);
void add_to_cutbuffer(filestruct *inptr, int allow_concat);
void cut_marked_segment(void);
-int do_cut_text(void);
-int do_uncut_text(void);
+void do_cut_text(void);
+void do_uncut_text(void);
/* Public functions in files.c */
void load_file(int update);
int read_file(FILE *f, const char *filename, int quiet);
int open_file(const char *filename, int insert, int quiet);
char *get_next_filename(const char *name);
-int do_insertfile(int loading_file);
-int do_insertfile_void(void);
+void do_insertfile(int loading_file);
+void do_insertfile_void(void);
#ifdef ENABLE_MULTIBUFFER
openfilestruct *make_new_opennode(openfilestruct *prevnode);
void splice_opennode(openfilestruct *begin, openfilestruct *newnode, openfilestruct *end);
void unlink_opennode(const openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
void free_openfilestruct(openfilestruct *src);
-int add_open_file(int update);
-int load_open_file(void);
-int open_prevfile(int closing_file);
-int open_prevfile_void(void);
-int open_nextfile(int closing_file);
-int open_nextfile_void(void);
+void add_open_file(int update);
+void load_open_file(void);
+void open_prevfile(int closing_file);
+void open_prevfile_void(void);
+void open_nextfile(int closing_file);
+void open_nextfile_void(void);
int close_open_file(void);
#endif
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
int write_marked(const char *name, int tmp, int append);
#endif
int do_writeout(int exiting);
-int do_writeout_void(void);
+void do_writeout_void(void);
char *real_dir_from_tilde(const char *buf);
#ifndef DISABLE_TABCOMP
int append_slash_if_dir(char *buf, int *lastwastab, int *place);
#ifndef DISABLE_HELP
const char *help,
#endif
- int metaval, int funcval, int miscval, int view, int
+ int metaval, int funcval, int miscval, int view, void
(*func)(void));
#ifndef NANO_SMALL
void toggle_init_one(int val, const char *desc, int flag);
#endif
/* Public functions in move.c */
-int do_first_line(void);
-int do_last_line(void);
-int do_home(void);
-int do_end(void);
-int do_page_up(void);
-int do_page_down(void);
-int do_up(void);
-int do_down(void);
-int do_left(int allow_update);
-int do_left_void(void);
-int do_right(int allow_update);
-int do_right_void(void);
+void do_first_line(void);
+void do_last_line(void);
+void do_home(void);
+void do_end(void);
+void do_page_up(void);
+void do_page_down(void);
+void do_up(void);
+void do_down(void);
+void do_left(int allow_update);
+void do_left_void(void);
+void do_right(int allow_update);
+void do_right_void(void);
/* Public functions in nano.c */
void finish(void);
void usage(void);
void version(void);
int no_help(void);
-int nano_disabled_msg(void);
+void nano_disabled_msg(void);
#ifndef NANO_SMALL
RETSIGTYPE cancel_fork(int signal);
int open_pipe(const char *command);
void do_mouse(void);
#endif
void do_char(char ch);
-int do_verbatim_input(void);
-int do_backspace(void);
-int do_delete(void);
-int do_tab(void);
-int do_enter(void);
+void do_verbatim_input(void);
+void do_backspace(void);
+void do_delete(void);
+void do_tab(void);
+void do_enter(void);
#ifndef NANO_SMALL
-int do_next_word(void);
-int do_prev_word(void);
-int do_mark(void);
+void do_next_word(void);
+void do_prev_word(void);
+void do_mark(void);
#endif
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
int do_int_spell_fix(const char *word);
const char *do_int_speller(char *tempfile_name);
const char *do_alt_speller(char *tempfile_name);
-int do_spell(void);
+void do_spell(void);
#endif
#if !defined(DISABLE_WRAPPING) && !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
size_t indent_length(const char *line);
int break_line(const char *line, int goal, int force);
int do_para_search(justbegend search_type, size_t *quote, size_t *par,
size_t *indent, int do_refresh);
-int do_para_begin(void);
-int do_para_end(void);
-int do_justify(int justify_all);
-int do_justify_void(void);
-int do_full_justify(void);
+void do_para_begin(void);
+void do_para_end(void);
+void do_justify(int full_justify);
+void do_justify_void(void);
+void do_full_justify(void);
#endif /* !DISABLE_JUSTIFY */
-int do_exit(void);
+void do_exit(void);
void signal_init(void);
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
*searchword);
int findnextstr(int can_display_wrap, int wholeword, const filestruct
*begin, size_t beginx, const char *needle, int no_sameline);
-int do_search(void);
+void do_search(void);
#ifndef NANO_SMALL
-int do_research(void);
+void do_research(void);
#endif
void replace_abort(void);
#ifdef HAVE_REGEX_H
char *replace_line(const char *needle);
int do_replace_loop(const char *needle, const filestruct *real_current,
size_t *real_current_x, int wholewords);
-int do_replace(void);
-int do_gotoline(int line, int save_pos);
-int do_gotoline_void(void);
+void do_replace(void);
+void do_gotoline(int line, int save_pos);
+void do_gotoline_void(void);
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant);
#endif
-int do_find_bracket(void);
+void do_find_bracket(void);
#ifndef NANO_SMALL
void history_init(void);
historytype *find_node(historytype *h, char *s);
#endif
const char *msg, ...);
int do_yesno(int all, const char *msg);
-int total_refresh(void);
+void total_refresh(void);
void display_main_list(void);
-int do_cursorpos(int constant);
-int do_cursorpos_void(void);
+void do_cursorpos(int constant);
+void do_cursorpos_void(void);
int line_len(const char *ptr);
-int do_help(void);
+void do_help(void);
void do_replace_highlight(int highlight_flag, const char *word);
#ifdef DEBUG
void dump_buffer(const filestruct *inptr);
#endif
i = (int)strtol(answer, &buf, 10); /* Just testing answer here. */
if (!(errno == ERANGE || *answer == '\0' || *buf != '\0'))
- do_gotoline(-1, 0);
+ do_gotoline(-1, FALSE);
else
do_gotoline_void();
/* Fall through. */
}
/* Search for a string. */
-int do_search(void)
+void do_search(void)
{
int old_pww = placewewant, i, fileptr_x = current_x, didfind;
filestruct *fileptr = current;
#endif
if (i != 0)
- return 0;
+ return;
/* If answer is now "", copy last_search into answer. */
if (answer[0] == '\0')
placewewant = xplustabs();
edit_redraw(fileptr, old_pww);
search_abort();
-
- return 1;
}
#ifndef NANO_SMALL
/* Search for the next string without prompting. */
-int do_research(void)
+void do_research(void)
{
int old_pww = placewewant, fileptr_x = current_x, didfind;
filestruct *fileptr = current;
#ifdef HAVE_REGEX_H
/* Since answer is "", use last_search! */
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
- return -1;
+ return;
#endif
search_last_line = FALSE;
placewewant = xplustabs();
edit_redraw(fileptr, old_pww);
search_abort();
-
- return 1;
}
#endif
}
/* Replace a string. */
-int do_replace(void)
+void do_replace(void)
{
int i, numreplaced;
filestruct *edittop_save, *begin;
if (ISSET(VIEW_MODE)) {
print_view_warning();
replace_abort();
- return 0;
+ return;
}
i = search_init(1);
if (i == -1) { /* Cancel, Go to Line, blank search
* string, or regcomp() failed. */
replace_abort();
- return 0;
+ return;
} else if (i == -2) { /* No Replace. */
do_search();
- return 0;
+ return;
} else if (i == 1) /* Case Sensitive, Backwards, or Regexp
* search toggle. */
do_replace();
if (i != 0)
- return 0;
+ return;
/* If answer is not "", add answer to the search history list and
* copy answer into last_search. */
statusbar(_("Replace Cancelled"));
}
replace_abort();
- return 0;
+ return;
}
last_replace = mallocstrcpy(last_replace, answer);
numreplaced), numreplaced);
replace_abort();
- return 1;
}
-int do_gotoline(int line, int save_pos)
+void do_gotoline(int line, int save_pos)
{
if (line <= 0) { /* Ask for it */
char *ans = mallocstrcpy(NULL, answer);
statusbar(_("Aborted"));
if (st != 0) {
display_main_list();
- return 0;
+ return;
}
line = atoi(answer);
if (line <= 0) {
statusbar(_("Come on, be reasonable"));
display_main_list();
- return 0;
+ return;
}
}
current_x = 0;
- /* If save_pos is nonzero, don't change the cursor position when
+ /* If save_pos is TRUE, don't change the cursor position when
* updating the edit window. */
edit_update(current, save_pos ? NONE : CENTER);
placewewant = 0;
display_main_list();
- return 1;
}
-int do_gotoline_void(void)
+void do_gotoline_void(void)
{
- return do_gotoline(0, 0);
+ do_gotoline(0, FALSE);
}
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
/* since do_gotoline() resets the x-coordinate but not the
y-coordinate, set the coordinates up this way */
current_y = pos_y;
- do_gotoline(line, 1);
+ do_gotoline(line, TRUE);
/* make sure that the x-coordinate is sane here */
if (pos_x > strlen(current->data))
#endif
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
-int do_find_bracket(void)
+void do_find_bracket(void)
{
char ch_under_cursor, wanted_ch;
const char *pos, *brackets = "([{<>}])";
pos = strchr(brackets, ch_under_cursor);
if (ch_under_cursor == '\0' || pos == NULL) {
statusbar(_("Not a bracket"));
- return 1;
+ return;
}
assert(strlen(brackets) % 2 == 0);
regexp_cleanup();
flags = flagsave;
- return 0;
}
#endif
return ok;
}
-int total_refresh(void)
+void total_refresh(void)
{
clearok(topwin, TRUE);
clearok(edit, TRUE);
clearok(bottomwin, FALSE);
edit_refresh();
titlebar(NULL);
- return 1;
}
void display_main_list(void)
* If constant is TRUE and DISABLE_CURPOS is set, we unset it and update
* old_i and old_totsize. That way, we leave the current statusbar
* alone, but next time we will display. */
-int do_cursorpos(int constant)
+void do_cursorpos(int constant)
{
const filestruct *fileptr;
unsigned long i = 0;
UNSET(DISABLE_CURPOS);
old_i = i;
old_totsize = totsize;
- return 0;
+ return;
}
/* If constant is FALSE, display the position on the statusbar
old_totsize = totsize;
reset_cursor();
- return 0;
}
-int do_cursorpos_void(void)
+void do_cursorpos_void(void)
{
- return do_cursorpos(FALSE);
+ do_cursorpos(FALSE);
}
/* Calculate the next line of help_text, starting at ptr. */
#ifndef DISABLE_HELP
/* Our dynamic, shortcut-list-compliant help function. */
-int do_help(void)
+void do_help(void)
{
int line = 0;
/* The line number in help_text of the first displayed help line.
* anymore. */
free(help_text);
help_text = NULL;
-
- return 1;
}
#endif /* !DISABLE_HELP */