utime(backupname, &filetime) == -1) {
free(backupname);
if (copy_status == -1)
- statusbar(_("Error reading %s: %s"), realname,
- strerror(errno));
+ statusbar(_("Error reading %s: %s"), realname, strerror(errno));
else
statusbar(_("Error writing %s: %s"), backupname,
strerror(errno));
* directory if it is .. or if it is a symlink to
* directory outside the operating directory. */
if (check_operating_dir(filelist[selected], FALSE) != 0) {
- statusbar(_("Can't go outside of %s in restricted mode"), operating_dir);
+ statusbar(_("Can't go outside of %s in restricted mode"),
+ operating_dir);
beep();
break;
}
#endif
if (stat(filelist[selected], &st) == -1) {
- statusbar(_("Can't open \"%s\": %s"), filelist[selected], strerror(errno));
+ statusbar(_("Can't open \"%s\": %s"), filelist[selected],
+ strerror(errno));
beep();
break;
}
if (!readable_dir(new_path)) {
/* We can't open this dir for some reason. Complain */
- statusbar(_("Can't open \"%s\": %s"), new_path, strerror(errno));
+ statusbar(_("Can't open \"%s\": %s"), new_path,
+ strerror(errno));
free(new_path);
break;
}
if (errno != ENOENT) {
/* Don't save history when we quit. */
UNSET(HISTORYLOG);
- rcfile_error(N_("Unable to open ~/.nano_history file: %s"),
- strerror(errno));
+ rcfile_error(N_("Unable to open ~/.nano_history file: %s"), strerror(errno));
}
free(nanohist);
} else {
if (homenv != NULL || userage != NULL) {
hist = fopen(nanohist, "wb");
- if (hist == NULL) {
- rcfile_error(N_("Unable to write ~/.nano_history file: %s"),
- strerror(errno));
- } else {
+ if (hist == NULL)
+ rcfile_error(N_("Unable to write ~/.nano_history file: %s"), strerror(errno));
+ else {
/* set rw only by owner for security ?? */
chmod(nanohist, S_IRUSR | S_IWUSR);
/* write oldest first */
h->data = charealloc(h->data, strlen(h->data) + 2);
strcat(h->data, "\n");
if (fputs(h->data, hist) == EOF) {
- rcfile_error(
- N_("Unable to write ~/.nano_history file: %s"),
- strerror(errno));
+ rcfile_error(N_("Unable to write ~/.nano_history file: %s"), strerror(errno));
goto come_from;
}
}
if (fputs("\n", hist) == EOF) {
- rcfile_error(
- N_("Unable to write ~/.nano_history file: %s"),
- strerror(errno));
+ rcfile_error(N_("Unable to write ~/.nano_history file: %s"), strerror(errno));
goto come_from;
}
for (h = replace_history.tail; h->prev; h = h->prev) {
h->data = charealloc(h->data, strlen(h->data) + 2);
strcat(h->data, "\n");
if (fputs(h->data, hist) == EOF) {
- rcfile_error(
- N_("Unable to write ~/.nano_history file: %s"),
- strerror(errno));
+ rcfile_error(N_("Unable to write ~/.nano_history file: %s"), strerror(errno));
goto come_from;
}
}
mcolor = COLOR_BLACK;
else {
rcfile_error(N_("Color %s not understood.\n"
- "Valid colors are \"green\", \"red\", \"blue\", \n"
- "\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
- "\"black\", with the optional prefix \"bright\" \n"
- "for foreground colors.\n"), colorname);
+ "Valid colors are \"green\", \"red\", \"blue\", \n"
+ "\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
+ "\"black\", with the optional prefix \"bright\" \n"
+ "for foreground colors.\n"), colorname);
mcolor = -1;
}
return mcolor;
return;
if (*ptr != '"') {
- rcfile_error(
- N_("Regex strings must begin and end with a \" character\n"));
+ rcfile_error(N_("Regex strings must begin and end with a \" character\n"));
return;
}
ptr++;
strtok(fgstr, ",");
bgcolorname = strtok(NULL, ",");
if (!strncasecmp(bgcolorname, "bright", 6)) {
- rcfile_error(N_("Background color %s cannot be bright"),
- bgcolorname);
+ rcfile_error(N_("Background color %s cannot be bright"), bgcolorname);
return;
}
bg = colortoint(bgcolorname, &bright);
}
if (*ptr != '"') {
- rcfile_error(
- N_("Regex strings must begin and end with a \" character\n"));
+ rcfile_error(N_("Regex strings must begin and end with a \" character\n"));
ptr = parse_next_regex(ptr);
continue;
}
if (expectend) {
if (ptr == NULL || strncasecmp(ptr, "end=", 4)) {
- rcfile_error(
- N_("\"start=\" requires a corresponding \"end=\""));
+ rcfile_error(N_("\"start=\" requires a corresponding \"end=\""));
return;
}
ptr += 4;
if (*ptr != '"') {
- rcfile_error(
- N_("Regex strings must begin and end with a \" character\n"));
+ rcfile_error(N_("Regex strings must begin and end with a \" character\n"));
continue;
}
ptr++;
#endif
) {
if (*ptr == '\n' || *ptr == '\0') {
- rcfile_error(
- N_("Option %s requires an argument"),
- rcopts[i].name);
+ rcfile_error(N_("Option %s requires an argument"), rcopts[i].name);
continue;
}
option = ptr;
#ifndef DISABLE_WRAPJUSTIFY
if (!strcasecmp(rcopts[i].name, "fill")) {
if (parse_num(option, &wrap_at) == -1)
- rcfile_error(
- N_("Requested fill size %s invalid"),
- option);
+ rcfile_error(N_("Requested fill size %s invalid"), option);
} else
#endif
#ifndef NANO_SMALL
whitespace = mallocstrcpy(NULL, option);
ws_len = strlen(whitespace);
if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) {
- rcfile_error(
- N_("Two non-control characters required"));
+ rcfile_error(N_("Two non-control characters required"));
free(whitespace);
whitespace = NULL;
}
if (!strcasecmp(rcopts[i].name, "punct")) {
punct = mallocstrcpy(NULL, option);
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
- rcfile_error(
- N_("Non-tab and non-space characters required"));
+ rcfile_error(N_("Non-tab and non-space characters required"));
free(punct);
punct = NULL;
}
} else if (!strcasecmp(rcopts[i].name, "brackets")) {
brackets = mallocstrcpy(NULL, option);
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
- rcfile_error(
- N_("Non-tab and non-space characters required"));
+ rcfile_error(N_("Non-tab and non-space characters required"));
free(brackets);
brackets = NULL;
}
else
#endif
if (!strcasecmp(rcopts[i].name, "tabsize")) {
- if (parse_num(option, &tabsize) == -1)
- rcfile_error(
- N_("Requested tab size %s invalid"),
- option);
+ if (parse_num(option, &tabsize) == -1 ||
+ tabsize <= 0)
+ rcfile_error(N_("Requested tab size %s invalid"), option);
}
} else
SET(rcopts[i].flag);
if ((rcstream = fopen(nanorc, "r")) == NULL) {
/* Don't complain about the file not existing */
if (errno != ENOENT) {
- rcfile_error(N_("Unable to open ~/.nanorc file, %s"),
- strerror(errno));
+ rcfile_error(N_("Unable to open ~/.nanorc file: %s"), strerror(errno));
SET(NO_RCFILE);
}
} else {