* line otherwise), and file conversion isn't disabled,
* handle it! */
if (!ISSET(NO_CONVERT) && (num_lines == 0 || format != 0) &&
- i > 0 && buf[i - 1] == '\r') {
+ i > 0 && buf[i - 1] == '\r') {
if (format == 0 || format == 2)
format++;
}
/* Tack the text at fileptr onto the beginning of the text
* at current. */
- openfile->current->data =
- charealloc(openfile->current->data, len +
- current_len + 1);
- charmove(openfile->current->data + len,
- openfile->current->data, current_len + 1);
+ openfile->current->data = charealloc(openfile->current->data,
+ len + 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! */
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
/* 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. */
beep();
return -1;
} else if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
- S_ISBLK(fileinfo.st_mode)) {
+ S_ISBLK(fileinfo.st_mode)) {
/* Don't open directories, character files, or block files.
* Sorry, /dev/sndstat! */
statusbar(S_ISDIR(fileinfo.st_mode) ?
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 {
*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
}
#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))
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
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;
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
/* 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) {
}
/* 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)
{
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] != '/') {
+ full_path[strlen(full_path) - 1] != '/') {
free(full_path);
return NULL;
}
* 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 &&
- openfile->current_stat->st_mtime == st.st_mtime))) {
+ 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;
char *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
+ * 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;
}
* 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) {
+ unlink(realname) == -1) {
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
goto cleanup_and_exit;
}
/* 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
}
* end of the file. Otherwise, add a magicline and treat it as the
* end of the file. */
if (!ISSET(NO_NEWLINES) &&
- (added_magicline = (openfile->filebot->data[0] != '\0')))
+ (added_magicline = (openfile->filebot->data[0] != '\0')))
new_magicline();
retval = write_file(name, f_open, tmp, append, TRUE);
* this is the first time we've done this, show an Easter
* egg. Display the credits. */
if (!did_credits && exiting && !ISSET(TEMP_FILE) &&
- strcasecmp(answer, "zzy") == 0) {
+ strcasecmp(answer, "zzy") == 0) {
do_credits();
did_credits = TRUE;
retval = FALSE;
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);
#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... */
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;
/* Don't save unchanged or empty histories. */
if (!history_has_changed() || (searchbot->lineno == 1 &&
- replacebot->lineno == 1))
+ replacebot->lineno == 1))
return;
nanohist = histfilename();
* 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));