From: David Lawrence Ramsey Date: Fri, 15 Apr 2005 17:48:20 +0000 (+0000) Subject: more cosmetic fixes X-Git-Tag: v1.3.8~330 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ac71fdde97d36d4a3270f0dd59d589b816ab270a;p=nano.git more cosmetic fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2470 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/src/files.c b/src/files.c index 7db6ab9c..5fdec471 100644 --- a/src/files.c +++ b/src/files.c @@ -1347,6 +1347,7 @@ int write_file(const char *name, bool tmp, int append, bool if (name[0] == '\0') return -1; + if (!tmp) titlebar(NULL); @@ -1463,8 +1464,9 @@ int write_file(const char *name, bool tmp, int append, bool /* And set metadata. */ if (copy_status != 0 || chown(backupname, - originalfilestat.st_uid, originalfilestat.st_gid) == -1 - || utime(backupname, &filetime) == -1) { + originalfilestat.st_uid, + originalfilestat.st_gid) == -1 || utime(backupname, + &filetime) == -1) { free(backupname); if (copy_status == -1) statusbar(_("Error reading %s: %s"), realname, @@ -1478,8 +1480,8 @@ int write_file(const char *name, bool tmp, int append, bool } #endif /* !NANO_SMALL */ - /* If NOFOLLOW_SYMLINKS and the file is a link, we aren't doing - * prepend or append. So we delete the link first, and just + /* If NOFOLLOW_SYMLINKS is set and the file is a link, we aren't + * doing prepend or append. So we delete the link first, and just * overwrite. */ if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode) && unlink(realname) == -1) { @@ -1542,7 +1544,7 @@ int write_file(const char *name, bool tmp, int append, bool /* Now open the file in place. Use O_EXCL if tmp is TRUE. This is * now copied from joe, because wiggy says so *shrug*. */ fd = open(realname, O_WRONLY | O_CREAT | - (append == 1 ? O_APPEND : (tmp ? O_EXCL : O_TRUNC)), + ((append == 1) ? O_APPEND : (tmp ? O_EXCL : O_TRUNC)), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); /* Set the umask back to the user's original value. */ @@ -1557,7 +1559,7 @@ int write_file(const char *name, bool tmp, int append, bool goto cleanup_and_exit; } - f = fdopen(fd, append == 1 ? "ab" : "wb"); + f = fdopen(fd, (append == 1) ? "ab" : "wb"); if (f == NULL) { statusbar(_("Error writing %s: %s"), realname, strerror(errno)); close(fd); @@ -1567,6 +1569,7 @@ int write_file(const char *name, bool tmp, int append, bool /* There might not be a magicline. There won't be when writing out * a selection. */ assert(fileage != NULL && filebot != NULL); + while (fileptr != filebot) { size_t data_len = strlen(fileptr->data); size_t size; @@ -1585,6 +1588,7 @@ int write_file(const char *name, bool tmp, int append, bool fclose(f); goto cleanup_and_exit; } + #ifndef NANO_SMALL if (fmt == DOS_FILE || fmt == MAC_FILE) { if (putc('\r', f) == EOF) { diff --git a/src/nano.c b/src/nano.c index f52778b0..cae70cd9 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1994,7 +1994,8 @@ const char *do_int_speller(const char *tempfile_name) int spell_status, sort_status, uniq_status; /* Create all three pipes up front. */ - if (pipe(spell_fd) == -1 || pipe(sort_fd) == -1 || pipe(uniq_fd) == -1) + if (pipe(spell_fd) == -1 || pipe(sort_fd) == -1 || + pipe(uniq_fd) == -1) return _("Could not create pipe"); statusbar(_("Creating misspelled word list, please wait..."));