Commit 459d9f8b authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Rewrapping some lines and tweaking two comments.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5368 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 213294e6
Showing with 35 additions and 47 deletions
+35 -47
2015-08-29 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/autoconf.nanor: New file; syntax colouring for Autoconf.
* src/files.c: Rewrap some lines and tweak two comments.
2015-08-16 Benno Schulenberg <bensberg@justemail.net>
* src/help.c (help_init, help_line_len): Avoid wide paragraphs of text
......
......@@ -808,11 +808,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
/* Tack the text at fileptr onto the beginning of the text
* at current. */
openfile->current->data =
charealloc(openfile->current->data, len +
openfile->current->data = charealloc(openfile->current->data,
len + current_len + 1);
charmove(openfile->current->data + len, openfile->current->data,
current_len + 1);
charmove(openfile->current->data + len,
openfile->current->data, current_len + 1);
strncpy(openfile->current->data, fileptr->data, len);
/* Don't destroy fileage, edittop, or filebot! */
......@@ -840,8 +839,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
renumber(openfile->current);
}
openfile->totsize += get_totsize(openfile->fileage,
openfile->filebot);
openfile->totsize += get_totsize(openfile->fileage, openfile->filebot);
/* If the NO_NEWLINES flag isn't set, and text has been added to
* the magicline (i.e. a file that doesn't end in a newline has been
......@@ -928,11 +926,10 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
/* 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))
if (full_filename == NULL || (stat(full_filename, &fileinfo) == -1 &&
stat(filename, &fileinfo2) != -1))
full_filename = mallocstrcpy(NULL, filename);
if (stat(full_filename, &fileinfo) == -1) {
/* Well, maybe we can open the file even if the OS says it's
* not there. */
......@@ -961,8 +958,7 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
beep();
return -1;
} else if ((fd = open(full_filename, O_RDONLY)) == -1) {
statusbar(_("Error reading %s: %s"), filename,
strerror(errno));
statusbar(_("Error reading %s: %s"), filename, strerror(errno));
beep();
return -1;
} else {
......@@ -970,8 +966,7 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
*f = fdopen(fd, "rb");
if (*f == NULL) {
statusbar(_("Error reading %s: %s"), filename,
strerror(errno));
statusbar(_("Error reading %s: %s"), filename, strerror(errno));
beep();
close(fd);
} else
......@@ -1132,8 +1127,7 @@ void do_insertfile(
}
#endif
/* If we don't have a file yet, go back to the statusbar
* prompt. */
/* If we don't have a file yet, go back to the statusbar prompt. */
if (i != 0
#ifndef DISABLE_MULTIBUFFER
&& (i != -2 || !ISSET(MULTIBUFFER))
......@@ -1166,8 +1160,7 @@ void do_insertfile(
filepart = partition_filestruct(openfile->current,
openfile->current_x, openfile->current,
openfile->current_x);
edittop_inside =
(openfile->edittop == openfile->fileage);
edittop_inside = (openfile->edittop == openfile->fileage);
#ifndef DISABLE_MULTIBUFFER
}
#endif
......@@ -1242,8 +1235,7 @@ void do_insertfile(
if (openfile->mark_set) {
openfile->mark_begin = openfile->current;
if (!right_side_up)
openfile->mark_begin_x +=
openfile->current_x;
openfile->mark_begin_x += openfile->current_x;
}
#endif
openfile->current_x += current_x_save;
......@@ -1255,8 +1247,7 @@ void do_insertfile(
openfile->mark_begin = openfile->current;
openfile->mark_begin_x -= current_x_save;
} else
openfile->mark_begin_x -=
openfile->current_x;
openfile->mark_begin_x -= openfile->current_x;
}
}
#endif
......@@ -1366,8 +1357,7 @@ char *get_full_path(const char *origpath)
/* If stat()ing d_there fails, assume that d_there refers to a new
* file that hasn't been saved to disk yet. Set path_only to TRUE
* if d_there refers to a directory, and FALSE otherwise. */
path_only = (stat(d_there, &fileinfo) != -1 &&
S_ISDIR(fileinfo.st_mode));
path_only = (stat(d_there, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode));
/* If path_only is TRUE, make sure d_there ends in a slash. */
if (path_only) {
......@@ -1453,7 +1443,7 @@ char *get_full_path(const char *origpath)
}
/* Return the full version of path, as returned by get_full_path(). On
* error, if path doesn't reference a directory, or if the directory
* error, or if path doesn't reference a directory, or if the directory
* isn't writable, return NULL. */
char *check_writable_directory(const char *path)
{
......@@ -1463,8 +1453,7 @@ char *check_writable_directory(const char *path)
if (full_path == NULL)
return NULL;
/* If we can't write to path or path isn't a directory, return
* NULL. */
/* If we can't write to path or path isn't a directory, return NULL. */
if (access(full_path, W_OK) != 0 ||
full_path[strlen(full_path) - 1] != '/') {
free(full_path);
......@@ -1768,8 +1757,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
* aren't appending, prepending, or writing a selection, we backup
* only if the file has not been modified by someone else since nano
* opened it. */
if (ISSET(BACKUP_FILE) && !tmp && realexists && ((append !=
OVERWRITE || openfile->mark_set) || (openfile->current_stat &&
if (ISSET(BACKUP_FILE) && !tmp && realexists && ((append != OVERWRITE ||
openfile->mark_set) || (openfile->current_stat &&
openfile->current_stat->st_mtime == st.st_mtime))) {
int backup_fd;
FILE *backup_file;
......@@ -1901,7 +1890,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
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
* 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;
}
......@@ -2141,8 +2130,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
/* If color syntaxes are available and turned on, we need to
* call edit_refresh(). */
if (openfile->colorstrings != NULL &&
!ISSET(NO_COLOR_SYNTAX))
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
edit_refresh();
#endif
}
......@@ -2569,8 +2557,7 @@ bool is_dir(const char *buf)
dirptr = real_dir_from_tilde(buf);
retval = (stat(dirptr, &fileinfo) != -1 &&
S_ISDIR(fileinfo.st_mode));
retval = (stat(dirptr, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode));
free(dirptr);
......@@ -2686,8 +2673,8 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
#endif
/* See if this matches. */
if (strncmp(nextdir->d_name, filename, filenamelen) == 0 &&
(*filename == '.' || (strcmp(nextdir->d_name, ".") !=
0 && strcmp(nextdir->d_name, "..") != 0))) {
(*filename == '.' || (strcmp(nextdir->d_name, ".") != 0 &&
strcmp(nextdir->d_name, "..") != 0))) {
/* Cool, found a match. Add it to the list. This makes a
* lot more sense to me (Chris) this way... */
......@@ -2735,7 +2722,8 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
size_t num_matches = 0, buf_len;
char **matches = NULL;
assert(buf != NULL && place != NULL && *place <= strlen(buf) && lastwastab != NULL && refresh_func != NULL && list != NULL);
assert(buf != NULL && place != NULL && *place <= strlen(buf) &&
lastwastab != NULL && refresh_func != NULL && list != NULL);
*list = FALSE;
......@@ -3095,8 +3083,7 @@ void save_history(void)
* history file. */
chmod(nanohist, S_IRUSR | S_IWUSR);
if (!writehist(hist, searchage) || !writehist(hist,
replaceage))
if (!writehist(hist, searchage) || !writehist(hist, replaceage))
history_error(N_("Error writing %s: %s"), nanohist,
strerror(errno));
......
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