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

more cosmetic fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2470 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent ffda704e
Showing with 12 additions and 7 deletions
+12 -7
...@@ -1347,6 +1347,7 @@ int write_file(const char *name, bool tmp, int append, bool ...@@ -1347,6 +1347,7 @@ int write_file(const char *name, bool tmp, int append, bool
if (name[0] == '\0') if (name[0] == '\0')
return -1; return -1;
if (!tmp) if (!tmp)
titlebar(NULL); titlebar(NULL);
...@@ -1463,8 +1464,9 @@ int write_file(const char *name, bool tmp, int append, bool ...@@ -1463,8 +1464,9 @@ int write_file(const char *name, bool tmp, int append, bool
/* And set metadata. */ /* And set metadata. */
if (copy_status != 0 || chown(backupname, if (copy_status != 0 || chown(backupname,
originalfilestat.st_uid, originalfilestat.st_gid) == -1 originalfilestat.st_uid,
|| utime(backupname, &filetime) == -1) { originalfilestat.st_gid) == -1 || utime(backupname,
&filetime) == -1) {
free(backupname); free(backupname);
if (copy_status == -1) if (copy_status == -1)
statusbar(_("Error reading %s: %s"), realname, statusbar(_("Error reading %s: %s"), realname,
...@@ -1478,8 +1480,8 @@ int write_file(const char *name, bool tmp, int append, bool ...@@ -1478,8 +1480,8 @@ int write_file(const char *name, bool tmp, int append, bool
} }
#endif /* !NANO_SMALL */ #endif /* !NANO_SMALL */
/* If NOFOLLOW_SYMLINKS and the file is a link, we aren't doing /* If NOFOLLOW_SYMLINKS is set and the file is a link, we aren't
* prepend or append. So we delete the link first, and just * doing prepend or append. So we delete the link first, and just
* overwrite. */ * overwrite. */
if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode) && if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode) &&
unlink(realname) == -1) { unlink(realname) == -1) {
...@@ -1542,7 +1544,7 @@ int write_file(const char *name, bool tmp, int append, bool ...@@ -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 open the file in place. Use O_EXCL if tmp is TRUE. This is
* now copied from joe, because wiggy says so *shrug*. */ * now copied from joe, because wiggy says so *shrug*. */
fd = open(realname, O_WRONLY | O_CREAT | 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); S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
/* Set the umask back to the user's original value. */ /* 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 ...@@ -1557,7 +1559,7 @@ int write_file(const char *name, bool tmp, int append, bool
goto cleanup_and_exit; goto cleanup_and_exit;
} }
f = fdopen(fd, append == 1 ? "ab" : "wb"); f = fdopen(fd, (append == 1) ? "ab" : "wb");
if (f == NULL) { if (f == NULL) {
statusbar(_("Error writing %s: %s"), realname, strerror(errno)); statusbar(_("Error writing %s: %s"), realname, strerror(errno));
close(fd); close(fd);
...@@ -1567,6 +1569,7 @@ int write_file(const char *name, bool tmp, int append, bool ...@@ -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 /* There might not be a magicline. There won't be when writing out
* a selection. */ * a selection. */
assert(fileage != NULL && filebot != NULL); assert(fileage != NULL && filebot != NULL);
while (fileptr != filebot) { while (fileptr != filebot) {
size_t data_len = strlen(fileptr->data); size_t data_len = strlen(fileptr->data);
size_t size; size_t size;
...@@ -1585,6 +1588,7 @@ int write_file(const char *name, bool tmp, int append, bool ...@@ -1585,6 +1588,7 @@ int write_file(const char *name, bool tmp, int append, bool
fclose(f); fclose(f);
goto cleanup_and_exit; goto cleanup_and_exit;
} }
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (fmt == DOS_FILE || fmt == MAC_FILE) { if (fmt == DOS_FILE || fmt == MAC_FILE) {
if (putc('\r', f) == EOF) { if (putc('\r', f) == EOF) {
......
...@@ -1994,7 +1994,8 @@ const char *do_int_speller(const char *tempfile_name) ...@@ -1994,7 +1994,8 @@ const char *do_int_speller(const char *tempfile_name)
int spell_status, sort_status, uniq_status; int spell_status, sort_status, uniq_status;
/* Create all three pipes up front. */ /* 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"); return _("Could not create pipe");
statusbar(_("Creating misspelled word list, please wait...")); statusbar(_("Creating misspelled word list, please wait..."));
......
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