#endif
#ifndef DISABLE_OPERATINGDIR
- if (operating_dir != NULL && strcmp(operating_dir, "."))
+ if (operating_dir != NULL && strcmp(operating_dir, ".") != 0)
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER))
i = statusq(TRUE, insertfile_list, inspath,
if (d_here != NULL) {
align(&d_here);
- if (strcmp(d_here, "/")) {
+ if (strcmp(d_here, "/") != 0) {
d_here = charealloc(d_here, strlen(d_here) + 2);
strcat(d_here, "/");
}
/* add a slash to d_there, unless it's "/", in which
case we don't need it */
- if (strcmp(d_there, "/")) {
+ if (strcmp(d_there, "/") != 0) {
d_there = charealloc(d_there, strlen(d_there) + 2);
strcat(d_there, "/");
}
#endif
#ifdef NANO_EXTRA
- if (exiting && !ISSET(TEMP_FILE) && !strcasecmp(answer, "zzy")
+ if (exiting && !ISSET(TEMP_FILE) && strcasecmp(answer, "zzy") == 0
&& !did_cred) {
do_credits();
did_cred = TRUE;
return -1;
}
#endif
- if (append == 0 && strcmp(answer, filename)) {
+ if (append == 0 && strcmp(answer, filename) != 0) {
struct stat st;
if (!stat(answer, &st)) {
do {
userdata = getpwent();
} while (userdata != NULL &&
- strncmp(userdata->pw_name, buf + 1, i - 1));
+ strncmp(userdata->pw_name, buf + 1, i - 1) != 0);
}
endpwent();
} else
tmp = buf;
- if (!strcmp(tmp, matches[0]))
+ if (strcmp(tmp, matches[0]) == 0)
is_dir = append_slash_if_dir(buf, lastwastab, newplace);
if (is_dir != 0)
*numents = 0;
while ((next = readdir(dir)) != NULL) {
- if (!strcmp(next->d_name, "."))
+ if (strcmp(next->d_name, ".") == 0)
continue;
(*numents)++;
if (strlen(next->d_name) > *longest)
filelist = (char **)nmalloc(*numents * sizeof (char *));
- if (!strcmp(path, "/"))
+ if (strcmp(path, "/") == 0)
path = "";
path_len = strlen(path);
while ((next = readdir(dir)) != NULL) {
- if (!strcmp(next->d_name, "."))
+ if (strcmp(next->d_name, ".") == 0)
continue;
filelist[i] = charalloc(strlen(next->d_name) + path_len + 2);
/* If path isn't the same as inpath, we are being passed a new
dir as an arg. We free it here so it will be copied from
inpath below */
- if (path != NULL && strcmp(path, inpath)) {
+ if (path != NULL && strcmp(path, inpath) != 0) {
free(path);
path = NULL;
}
case 'S': /* Pico compatibility */
case 's':
/* You can't cd up from / */
- if (!strcmp(filelist[selected], "/..") && !strcmp(path, "/")) {
+ if (strcmp(filelist[selected], "/..") == 0 &&
+ strcmp(path, "/") == 0) {
statusbar(_("Can't move up a directory"));
beep();
break;
do_replace_highlight(FALSE, word);
- if (i != -1 && strcmp(word, answer)) {
+ if (i != -1 && strcmp(word, answer) != 0) {
search_last_line = FALSE;
current_x--;
do_replace_loop(word, current_save, ¤t_x_save, TRUE);
size_t qdepth = 0;
/* Compute quote depth level. */
- while (!strcmp(line + qdepth, quotestr))
+ while (strncmp(line + qdepth, quotestr, quotelen) == 0)
qdepth += quotelen;
return qdepth;
#endif /* !HAVE_REGEX_H */
/* Here is the assumption about a_quote: */
assert(a_quote == quote_length(a_line));
return a_quote == quote_length(b_line) &&
- !strncmp(a_line, b_line, a_quote);
+ strncmp(a_line, b_line, a_quote) == 0;
}
/* We assume a_line and b_line have no quote part. Then, we return
assert(a_indent == indent_length(a_line));
assert(b_indent == indent_length(b_line));
- return b_indent <= a_indent && !strncmp(a_line, b_line, b_indent);
+ return b_indent <= a_indent &&
+ strncmp(a_line, b_line, b_indent) == 0;
}
/* Is foo the beginning of a paragraph?
if (colorname == NULL)
return -1;
- if (!strncasecmp(colorname, "bright", 6)) {
+ if (strncasecmp(colorname, "bright", 6) == 0) {
*bright = 1;
colorname += 6;
}
- if (!strcasecmp(colorname, "green"))
+ if (strcasecmp(colorname, "green") == 0)
mcolor = COLOR_GREEN;
- else if (!strcasecmp(colorname, "red"))
+ else if (strcasecmp(colorname, "red") == 0)
mcolor = COLOR_RED;
- else if (!strcasecmp(colorname, "blue"))
+ else if (strcasecmp(colorname, "blue") == 0)
mcolor = COLOR_BLUE;
- else if (!strcasecmp(colorname, "white"))
+ else if (strcasecmp(colorname, "white") == 0)
mcolor = COLOR_WHITE;
- else if (!strcasecmp(colorname, "yellow"))
+ else if (strcasecmp(colorname, "yellow") == 0)
mcolor = COLOR_YELLOW;
- else if (!strcasecmp(colorname, "cyan"))
+ else if (strcasecmp(colorname, "cyan") == 0)
mcolor = COLOR_CYAN;
- else if (!strcasecmp(colorname, "magenta"))
+ else if (strcasecmp(colorname, "magenta") == 0)
mcolor = COLOR_MAGENTA;
- else if (!strcasecmp(colorname, "black"))
+ else if (strcasecmp(colorname, "black") == 0)
mcolor = COLOR_BLACK;
else {
rcfile_error(N_("Color %s not understood.\n"
char *bgcolorname;
strtok(fgstr, ",");
bgcolorname = strtok(NULL, ",");
- if (!strncasecmp(bgcolorname, "bright", 6)) {
+ if (strncasecmp(bgcolorname, "bright", 6) == 0) {
rcfile_error(N_("Background color %s cannot be bright\n"), bgcolorname);
return;
}
if (*ptr == '\n' || *ptr == '\0')
break;
- if (!strncasecmp(ptr, "start=", 6)) {
+ if (strncasecmp(ptr, "start=", 6) == 0) {
ptr += 6;
expectend = 1;
}
}
if (expectend) {
- if (ptr == NULL || strncasecmp(ptr, "end=", 4)) {
+ if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
rcfile_error(N_("\"start=\" requires a corresponding \"end=\"\n"));
return;
}
continue;
/* Else try to parse the keyword */
- if (!strcasecmp(keyword, "set"))
+ if (strcasecmp(keyword, "set") == 0)
set = 1;
- else if (!strcasecmp(keyword, "unset"))
+ else if (strcasecmp(keyword, "unset") == 0)
set = -1;
#ifdef ENABLE_COLOR
- else if (!strcasecmp(keyword, "syntax"))
+ else if (strcasecmp(keyword, "syntax") == 0)
parse_syntax(ptr);
- else if (!strcasecmp(keyword, "color"))
+ else if (strcasecmp(keyword, "color") == 0)
parse_colors(ptr);
#endif /* ENABLE_COLOR */
else {
if (set != 0) {
for (i = 0; rcopts[i].name != NULL; i++) {
- if (!strcasecmp(option, rcopts[i].name)) {
+ if (strcasecmp(option, rcopts[i].name) == 0) {
#ifdef DEBUG
fprintf(stderr, "%s: Parsing option %s\n",
"parse_rcfile()", rcopts[i].name);
#endif
if (set == 1) {
- if (!strcasecmp(rcopts[i].name, "tabsize")
+ if (strcasecmp(rcopts[i].name, "tabsize") == 0
#ifndef DISABLE_OPERATINGDIR
- || !strcasecmp(rcopts[i].name, "operatingdir")
+ || strcasecmp(rcopts[i].name, "operatingdir") == 0
#endif
#ifndef DISABLE_WRAPJUSTIFY
- || !strcasecmp(rcopts[i].name, "fill")
+ || strcasecmp(rcopts[i].name, "fill") == 0
#endif
#ifndef NANO_SMALL
- || !strcasecmp(rcopts[i].name, "whitespace")
+ || strcasecmp(rcopts[i].name, "whitespace") == 0
#endif
#ifndef DISABLE_JUSTIFY
- || !strcasecmp(rcopts[i].name, "punct")
- || !strcasecmp(rcopts[i].name, "brackets")
- || !strcasecmp(rcopts[i].name, "quotestr")
+ || strcasecmp(rcopts[i].name, "punct") == 0
+ || strcasecmp(rcopts[i].name, "brackets") == 0
+ || strcasecmp(rcopts[i].name, "quotestr") == 0
#endif
#ifndef NANO_SMALL
- || !strcasecmp(rcopts[i].name, "backupdir")
+ || strcasecmp(rcopts[i].name, "backupdir") == 0
#endif
#ifndef DISABLE_SPELLER
- || !strcasecmp(rcopts[i].name, "speller")
+ || strcasecmp(rcopts[i].name, "speller") == 0
#endif
) {
if (*ptr == '\n' || *ptr == '\0') {
fprintf(stderr, "option = %s\n", option);
#endif
#ifndef DISABLE_OPERATINGDIR
- if (!strcasecmp(rcopts[i].name, "operatingdir"))
+ if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
operating_dir = mallocstrcpy(NULL, option);
else
#endif
#ifndef DISABLE_WRAPJUSTIFY
- if (!strcasecmp(rcopts[i].name, "fill")) {
+ if (strcasecmp(rcopts[i].name, "fill") == 0) {
if (parse_num(option, &wrap_at) == -1) {
rcfile_error(N_("Requested fill size %s invalid\n"), option);
wrap_at = -CHARS_FROM_EOL;
} else
#endif
#ifndef NANO_SMALL
- if (!strcasecmp(rcopts[i].name, "whitespace")) {
+ if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
size_t ws_len;
whitespace = mallocstrcpy(NULL, option);
ws_len = strlen(whitespace);
} else
#endif
#ifndef DISABLE_JUSTIFY
- if (!strcasecmp(rcopts[i].name, "punct")) {
+ if (strcasecmp(rcopts[i].name, "punct") == 0) {
punct = mallocstrcpy(NULL, option);
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
rcfile_error(N_("Non-tab and non-space characters required\n"));
free(punct);
punct = NULL;
}
- } else if (!strcasecmp(rcopts[i].name, "brackets")) {
+ } else if (strcasecmp(rcopts[i].name, "brackets") == 0) {
brackets = mallocstrcpy(NULL, option);
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
rcfile_error(N_("Non-tab and non-space characters required\n"));
free(brackets);
brackets = NULL;
}
- } else if (!strcasecmp(rcopts[i].name, "quotestr"))
+ } else if (strcasecmp(rcopts[i].name, "quotestr") == 0)
quotestr = mallocstrcpy(NULL, option);
else
#endif
#ifndef NANO_SMALL
- if (!strcasecmp(rcopts[i].name, "backupdir"))
+ if (strcasecmp(rcopts[i].name, "backupdir") == 0)
backup_dir = mallocstrcpy(NULL, option);
else
#endif
#ifndef DISABLE_SPELLER
- if (!strcasecmp(rcopts[i].name, "speller"))
+ if (strcasecmp(rcopts[i].name, "speller") == 0)
alt_speller = mallocstrcpy(NULL, option);
else
#endif
- if (!strcasecmp(rcopts[i].name, "tabsize")) {
+ if (strcasecmp(rcopts[i].name, "tabsize") == 0) {
if (parse_num(option, &tabsize) == -1 || tabsize <= 0)
rcfile_error(N_("Requested tab size %s invalid\n"), option);
tabsize = -1;