From: David Lawrence Ramsey Date: Wed, 1 Dec 2004 15:11:27 +0000 (+0000) Subject: change references to "open files" to "open file buffers" for X-Git-Tag: v1.3.6~247 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=3ece0b9aebde9f8f8c614ffdc21128729c80cb81;p=nano.git change references to "open files" to "open file buffers" for consistency, and add DB's changes to die() so that it works properly with the overhauled multibuffer routines git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2153 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 081efd78..0f5cfd1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,8 @@ CVS code - free_filestruct(); removal of open_prevfile() and open_nextfile(). (David Benbennick, minor tweaks and additions by DLR) + - Change references to "open files" to "open file buffers", for + consistency. (DLR) - cut.c: do_cut_text() - If keep_cutbuffer is FALSE, only blow away the text in the diff --git a/src/files.c b/src/files.c index 29c6b52f..e725dc29 100644 --- a/src/files.c +++ b/src/files.c @@ -823,7 +823,7 @@ void add_open_file(bool update) } /* Read the current entry in the open_files structure and set up the - * currently open file using that entry's information. */ + * currently open file buffer using that entry's information. */ void load_open_file(void) { assert(open_files != NULL); @@ -887,17 +887,17 @@ void load_open_file(void) titlebar(NULL); } -/* Open either the next or previous file. */ +/* Open either the next or previous file buffer. */ void open_prevnext_file(bool next) { add_open_file(TRUE); assert(open_files != NULL); - /* If only one file is open, indicate it on the statusbar and get - * out. */ + /* If only one file buffer is open, indicate it on the statusbar and + * get out. */ if (open_files == open_files->next) { - statusbar(_("No more open files")); + statusbar(_("No more open file buffers")); return; } @@ -938,7 +938,7 @@ void open_nextfile_void(void) /* Delete an entry from the open_files filestruct. After deletion of an * entry, the next entry is opened. Return TRUE on success or FALSE if - * there are no more open files. */ + * there are no more open file buffers. */ bool close_open_file(void) { assert(open_files != NULL); diff --git a/src/global.c b/src/global.c index 179406ad..dd9c2ad4 100644 --- a/src/global.c +++ b/src/global.c @@ -70,7 +70,8 @@ partition *filepart = NULL; /* A place to store a portion of the file struct */ #ifdef ENABLE_MULTIBUFFER -openfilestruct *open_files = NULL; /* The list of open files */ +openfilestruct *open_files = NULL; /* The list of open file + buffers */ #endif #if !defined(NANO_SMALL) && defined(ENABLE_NANORC) diff --git a/src/nano.c b/src/nano.c index 0b386c21..566b8a65 100644 --- a/src/nano.c +++ b/src/nano.c @@ -124,41 +124,32 @@ void die(const char *msg, ...) vfprintf(stderr, msg, ap); va_end(ap); - /* save the currently loaded file if it's been modified */ + /* Save the current file buffer if it's been modified. */ if (ISSET(MODIFIED)) die_save_file(filename); #ifdef ENABLE_MULTIBUFFER - /* then save all of the other modified loaded files, if any */ + /* Save all of the other modified file buffers, if any. */ if (open_files != NULL) { - openfilestruct *tmp; + openfilestruct *tmp = open_files; - tmp = open_files; - - while (open_files->prev != NULL) - open_files = open_files->prev; - - while (open_files->next != NULL) { + while (tmp != open_files->next) { + open_files = open_files->next; - /* if we already saved the file above (i.e, if it was the - currently loaded file), don't save it again */ - if (tmp != open_files) { - /* make sure open_files->fileage and fileage, and - open_files->filebot and filebot, are in sync; they - might not be if lines have been cut from the top or - bottom of the file */ + /* Save the current file buffer if it's been modified. */ + if (open_files->flags & MODIFIED) { + /* Set fileage and filebot to match the current file + * buffer, and then write it to disk. */ fileage = open_files->fileage; filebot = open_files->filebot; - /* save the file if it's been modified */ - if (open_files->flags & MODIFIED) - die_save_file(open_files->filename); + die_save_file(open_files->filename); } - open_files = open_files->next; } } #endif - exit(1); /* We have a problem: exit w/ errorlevel(1) */ + /* Get out. */ + exit(1); } void die_save_file(const char *die_filename) @@ -3125,7 +3116,7 @@ void do_exit(void) if (i == 0 || (i == 1 && do_writeout(TRUE) > 0)) { #ifdef ENABLE_MULTIBUFFER - /* Exit only if there are no more open buffers. */ + /* Exit only if there are no more open file buffers. */ if (!close_open_file()) #endif finish();