Commit 38e8ed14 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Normalizing the whitespace and some comments in src/files.c.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5270 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 74 additions and 78 deletions
+74 -78
......@@ -6,6 +6,7 @@
a temporary file as parameter, so forget the case of an empty filename.
Also, don't bother putting the pointer at the top of the buffer, as the
first action after this function is to restore the cursor position.
* src/files.c: Normalize the whitespace and some comments.
2015-06-23 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): Verify that there exists multidata for the
......
......@@ -160,7 +160,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
/* Maybe we just don't have write access. Print an error message
and continue. */
* and continue. */
if (fd < 0) {
statusbar(_("Error writing lock file %s: %s"), lockfilename,
strerror(errno));
......@@ -288,10 +288,8 @@ int do_lockfile(const char *filename)
strncpy(lockuser, &lockbuf[28], 16);
#ifdef DEBUG
fprintf(stderr, "lockpid = %d\n", lockpid);
fprintf(stderr, "program name which created this lock file should be %s\n",
lockprog);
fprintf(stderr, "user which created this lock file should be %s\n",
lockuser);
fprintf(stderr, "program name which created this lock file should be %s\n", lockprog);
fprintf(stderr, "user which created this lock file should be %s\n", lockuser);
#endif
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
sprintf(promptstr, _("File %s is being edited (by %s with %s, PID %d); continue?"),
......@@ -311,7 +309,6 @@ int do_lockfile(const char *filename)
}
}
return write_lockfile(lockfilename, filename, FALSE);
}
#endif /* !NANO_TINY */
......@@ -364,7 +361,6 @@ void open_buffer(const char *filename, bool undoable)
#endif
}
/* If the filename isn't blank, and we are not in NOREAD_MODE,
* open the file. Otherwise, treat it as a new file. */
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
......@@ -424,7 +420,6 @@ void replace_buffer(const char *filename)
/* If opening the file succeeded, read it in. */
if (descriptor > 0)
read_file(f, descriptor, filename, FALSE, TRUE);
}
#endif /* !DISABLE_SPELLER */
......@@ -473,8 +468,8 @@ void switch_to_prevnext_buffer(bool next_buf, bool quiet)
/* Indicate the switch on the statusbar. */
if (quiet == FALSE)
statusbar(_("Switched to %s"),
((openfile->filename[0] == '\0') ? _("New Buffer") :
openfile->filename));
((openfile->filename[0] == '\0') ?
_("New Buffer") : openfile->filename));
#ifdef DEBUG
dump_filestruct(openfile->current);
......@@ -547,14 +542,14 @@ int is_file_writable(const char *filename)
full_filename = get_full_path(filename);
/* Okay, if we can't stat the path due to a component's
permissions, just try the relative one. */
if (full_filename == NULL
|| (stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
*permissions, just try the relative one. */
if (full_filename == NULL ||
(stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
full_filename = mallocstrcpy(NULL, filename);
if ((fd = open(full_filename, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR |
S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1
|| (f = fdopen(fd, "a")) == NULL)
S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1 ||
(f = fdopen(fd, "a")) == NULL)
ans = FALSE;
else
fclose(f);
......@@ -918,7 +913,7 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
full_filename = get_full_path(filename);
/* Okay, if we can't stat the path due to a component's
permissions, just try the relative one. */
* permissions, just try the relative one. */
if (full_filename == NULL
|| (stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
full_filename = mallocstrcpy(NULL, filename);
......@@ -1896,9 +1891,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
free(backupname);
fclose(backup_file);
/* If we can't write to the backup, DONT go on, since
whatever caused the backup file to fail (e.g. disk
full may well cause the real file write to fail, which
means we could lose both the backup and the original! */
* whatever caused the backup file to fail (e.g. disk
* full may well cause the real file write to fail, which
* means we could lose both the backup and the original! */
goto cleanup_and_exit;
}
......
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