From: markus schnalke Date: Thu, 5 Jan 2012 18:18:12 +0000 (+0100) Subject: Explicit checks for return values of strcmp(). X-Git-Tag: mmh-thesis-end~418 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=d3ba09a465cb0e5fc9a74d0b152a7ed965f895cb;p=mmh Explicit checks for return values of strcmp(). The return value of strcmp() is unintuitive for string equality tests. I prefer explicit comparisions against 0. I changed this everywhere. --- diff --git a/h/fmt_scan.h b/h/fmt_scan.h index 96acd56..38e2793 100644 --- a/h/fmt_scan.h +++ b/h/fmt_scan.h @@ -59,7 +59,7 @@ extern struct comp *wantcomp[128]; */ #define FINDCOMP(comp,name) \ for (comp = wantcomp[CHASH(name)]; \ - comp && strcmp(comp->c_name,name); \ + comp && strcmp(comp->c_name,name)!=0; \ comp = comp->c_next) ; /* diff --git a/sbr/context_replace.c b/sbr/context_replace.c index 6b3aa2f..4d81356 100644 --- a/sbr/context_replace.c +++ b/sbr/context_replace.c @@ -36,7 +36,7 @@ context_replace(char *key, char *value) */ for (np = m_defs;; np = np->n_next) { if (!mh_strcasecmp(np->n_name, key)) { - if (strcmp(value, np->n_field)) { + if (strcmp(value, np->n_field)!=0) { if (!np->n_context) admonish(NULL, "bug: context_replace(key=\"%s\",value=\"%s\")", key, value); if (np->n_field) diff --git a/sbr/crawl_folders.c b/sbr/crawl_folders.c index 0693a21..0185bd8 100644 --- a/sbr/crawl_folders.c +++ b/sbr/crawl_folders.c @@ -84,7 +84,8 @@ add_children(char *name, struct crawl_context *crawl) continue; } #endif - if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) { + if (strcmp(dp->d_name, ".")==0 || + strcmp(dp->d_name, "..")==0) { continue; } child = concat(prefix, dp->d_name, (void *)NULL); diff --git a/sbr/folder_read.c b/sbr/folder_read.c index cdbf344..5195592 100644 --- a/sbr/folder_read.c +++ b/sbr/folder_read.c @@ -111,12 +111,12 @@ folder_read(char *name) ** skip any files beginning with ** backup prefix */ - if (!strncmp(dp->d_name, backup_prefix, - prefix_len)) + if (strncmp(dp->d_name, backup_prefix, + prefix_len)==0) continue; /* skip the altmsg link file */ - if (!strcmp(dp->d_name, altmsglink)) + if (strcmp(dp->d_name, altmsglink)==0) continue; /* diff --git a/sbr/m_convert.c b/sbr/m_convert.c index df128d7..734bdb5 100644 --- a/sbr/m_convert.c +++ b/sbr/m_convert.c @@ -79,7 +79,7 @@ m_convert(struct msgs *mp, char *name) ** ALLOW_BEYOND is set, and can appear only on its own. ** Also, it is available in any folder. */ - if ((mp->msgflags & ALLOW_BEYOND) && !strcmp(cp, seq_beyond)) { + if ((mp->msgflags & ALLOW_BEYOND) && strcmp(cp, seq_beyond)==0) { addtosel(mp, getbeyond(mp)); return 1; } @@ -87,7 +87,7 @@ m_convert(struct msgs *mp, char *name) /* ** Handle the special all sequence: replace `a' with `f-l' */ - if (!strcmp(cp, seq_all)) { + if (strcmp(cp, seq_all)==0) { cp = concat(seq_first, "-", seq_last, NULL); } @@ -203,7 +203,7 @@ rangerr: */ if (first > mp->hghmsg || first < mp->lowmsg || !does_exist(mp, first)) { - if (!strcmp(name, seq_cur)) + if (strcmp(name, seq_cur)==0) advise(NULL, "no current message"); else /* this case seems to never be reached */ @@ -342,7 +342,7 @@ attr(struct msgs *mp, char *cp) int first = 0; /* hack for "c-..." */ - if (!strcmp(cp, seq_cur)) + if (strcmp(cp, seq_cur)==0) return 0; /* "c:..." -- this code need to be rewritten... */ if (strncmp(seq_cur, cp, strlen(seq_cur))==0 && @@ -375,17 +375,17 @@ attr(struct msgs *mp, char *cp) ** seq:l */ if (isalpha(*dp)) { - if (!strcmp(dp, seq_prev)) { + if (strcmp(dp, seq_prev)==0) { convdir = -1; first = (mp->curmsg > 0) && (mp->curmsg <= mp->hghmsg) ? mp->curmsg - 1 : mp->hghmsg; - } else if (!strcmp(dp, seq_next)) { + } else if (strcmp(dp, seq_next)==0) { convdir = 1; first = (mp->curmsg >= mp->lowmsg) ? mp->curmsg + 1 : mp->lowmsg; - } else if (!strcmp(dp, seq_first)) { + } else if (strcmp(dp, seq_first)==0) { convdir = 1; - } else if (!strcmp(dp, seq_last)) { + } else if (strcmp(dp, seq_last)==0) { convdir = -1; } else return BADLST; diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index db509fc..1ff8e32 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -716,7 +716,7 @@ m_Eom(int c, FILE *iob) pos = ftell(iob); if ((i = fread(text, sizeof *text, edelimlen, iob)) != edelimlen - || strncmp(text, (char *)edelim, edelimlen)) { + || (strncmp(text, (char *)edelim, edelimlen)!=0)) { if (i == 0 && msg_style == MS_MBOX) /* ** the final newline in the (brain damaged) unix-format diff --git a/sbr/mf.c b/sbr/mf.c index 45bbecd..53752a3 100644 --- a/sbr/mf.c +++ b/sbr/mf.c @@ -54,10 +54,9 @@ getcpy(char *s) static int isat(char *p) { - return (strncmp(p, " AT ", 4) - && strncmp(p, " At ", 4) - && strncmp(p, " aT ", 4) - && strncmp(p, " at ", 4) ? FALSE : TRUE); + return (strncmp(p, " AT ", 4)!=0 && strncmp(p, " At ", 4)!=0 && + strncmp(p, " aT ", 4)!=0 && strncmp(p, " at ", 4)!=0 ? + FALSE : TRUE); } diff --git a/sbr/mts.c b/sbr/mts.c index 9638f56..4f9d058 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -463,7 +463,7 @@ mts_read_conf_file(FILE *fp) *bp++ = 0; for (b = binds; b->keyword; b++) - if (!strcmp(buffer, b->keyword)) + if (strcmp(buffer, b->keyword)==0) break; if (b->keyword && (cp = tailor_value(bp))) *b->value = cp; diff --git a/sbr/norm_charmap.c b/sbr/norm_charmap.c index ca3a2c4..02e6a3c 100644 --- a/sbr/norm_charmap.c +++ b/sbr/norm_charmap.c @@ -43,34 +43,34 @@ norm_charmap(char *name) ** can see what output to expect, and modify for your needs ** as necessary. */ - if (!strcmp(name, "UTF-8")) + if (strcmp(name, "UTF-8")==0) return "UTF-8"; - if (!strcmp(name, "EUC-JP")) + if (strcmp(name, "EUC-JP")==0) return "EUC-JP"; - if (!strcmp(name, "EUC-KR")) + if (strcmp(name, "EUC-KR")==0) return "EUC-KR"; - if (!strcmp(name, "EUC-TW")) + if (strcmp(name, "EUC-TW")==0) return "EUC-TW"; - if (!strcmp(name, "KOI8-R")) + if (strcmp(name, "KOI8-R")==0) return "KOI8-R"; - if (!strcmp(name, "KOI8-U")) + if (strcmp(name, "KOI8-U")==0) return "KOI8-U"; - if (!strcmp(name, "GBK")) + if (strcmp(name, "GBK")==0) return "GBK"; - if (!strcmp(name, "GB2312")) + if (strcmp(name, "GB2312")==0) return "GB2312"; - if (!strcmp(name, "GB18030")) + if (strcmp(name, "GB18030")==0) return "GB18030"; - if (!strcmp(name, "VSCII")) + if (strcmp(name, "VSCII")==0) return "VSCII"; /* ASCII comes in many names */ - if (!strcmp(name, "ASCII") || - !strcmp(name, "US-ASCII") || - !strcmp(name, "ANSI_X3.4-1968") || - !strcmp(name, "646") || - !strcmp(name, "ISO646") || - !strcmp(name, "ISO_646.IRV")) + if (strcmp(name, "ASCII")==0 || + strcmp(name, "US-ASCII")==0 || + strcmp(name, "ANSI_X3.4-1968")==0 || + strcmp(name, "646")==0 || + strcmp(name, "ISO646")==0 || + strcmp(name, "ISO_646.IRV")==0) return "US-ASCII"; /* ISO 8859 will be converted to "ISO-8859-x" */ @@ -98,14 +98,14 @@ norm_charmap(char *name) } /* TIS-620 comes in at least the following two forms */ - if (!strcmp(name, "TIS-620") || - !strcmp(name, "TIS620.2533")) + if (strcmp(name, "TIS-620")==0 || + strcmp(name, "TIS620.2533")==0) return "ISO-8859-11"; /* For some, uppercase/lowercase might differ */ - if (!strcmp(name, "Big5") || !strcmp(name, "BIG5")) + if (strcmp(name, "Big5")==0 || strcmp(name, "BIG5")==0) return "Big5"; - if (!strcmp(name, "Big5HKSCS") || !strcmp(name, "BIG5HKSCS")) + if (strcmp(name, "Big5HKSCS")==0 || strcmp(name, "BIG5HKSCS")==0) return "Big5HKSCS"; /* diff --git a/sbr/ruserpass.c b/sbr/ruserpass.c index f88fcef..0e169a5 100644 --- a/sbr/ruserpass.c +++ b/sbr/ruserpass.c @@ -211,7 +211,7 @@ token(void) if (tokval[0] == 0) return (0); for (t = toktabs; t->tokstr; t++) - if (!strcmp(t->tokstr, tokval)) + if (strcmp(t->tokstr, tokval)==0) return (t->tval); return (ID); } diff --git a/sbr/seq_add.c b/sbr/seq_add.c index 38bbdcf..5d0987c 100644 --- a/sbr/seq_add.c +++ b/sbr/seq_add.c @@ -33,14 +33,14 @@ seq_addsel(struct msgs *mp, char *cp, int public, int zero) ** We keep mp->curmsg and cur sequence in sync. ** See seq_list() and seq_init(). */ - if (!strcmp(seq_cur, cp)) + if (strcmp(seq_cur, cp)==0) mp->curmsg = mp->hghsel; /* ** Get the number for this sequence */ for (i = 0; mp->msgattrs[i]; i++) { - if (!strcmp(mp->msgattrs[i], cp)) { + if (strcmp(mp->msgattrs[i], cp)==0) { new_seq = 0; break; } @@ -124,14 +124,14 @@ seq_addmsg(struct msgs *mp, char *cp, int msgnum, int public, int zero) /* ** keep mp->curmsg and msgattrs[] of seq_cur in sync - see seq_list() */ - if (!strcmp(seq_cur, cp)) + if (strcmp(seq_cur, cp)==0) mp->curmsg = msgnum; /* ** Get the number for this sequence */ for (i = 0; mp->msgattrs[i]; i++) { - if (!strcmp(mp->msgattrs[i], cp)) { + if (strcmp(mp->msgattrs[i], cp)==0) { new_seq = 0; break; } diff --git a/sbr/seq_del.c b/sbr/seq_del.c index 92e2f1e..e342d1c 100644 --- a/sbr/seq_del.c +++ b/sbr/seq_del.c @@ -33,7 +33,7 @@ seq_delsel(struct msgs *mp, char *cp, int public, int zero) ** Get the number for this sequence */ for (i = 0; mp->msgattrs[i]; i++) { - if (!strcmp(mp->msgattrs[i], cp)) { + if (strcmp(mp->msgattrs[i], cp)==0) { new_seq = 0; break; } @@ -119,7 +119,7 @@ seq_delmsg(struct msgs *mp, char *cp, int msgnum) return 0; for (i = 0; mp->msgattrs[i]; i++) { - if (!strcmp(mp->msgattrs[i], cp)) { + if (strcmp(mp->msgattrs[i], cp)==0) { clear_sequence(mp, i, msgnum); mp->msgflags |= SEQMOD; return 1; diff --git a/sbr/seq_getnum.c b/sbr/seq_getnum.c index 4605915..3c3b910 100644 --- a/sbr/seq_getnum.c +++ b/sbr/seq_getnum.c @@ -16,7 +16,7 @@ seq_getnum(struct msgs *mp, char *seqname) int i; for (i = 0; mp->msgattrs[i]; i++) - if (!strcmp(mp->msgattrs[i], seqname)) + if (strcmp(mp->msgattrs[i], seqname)==0) return i; return -1; diff --git a/sbr/seq_list.c b/sbr/seq_list.c index a6cdbda..f051e38 100644 --- a/sbr/seq_list.c +++ b/sbr/seq_list.c @@ -36,7 +36,7 @@ seq_list(struct msgs *mp, char *seqname) ** This is returned, even if message doesn't exist or the ** folder is empty. */ - if (!strcmp(seq_cur, seqname)) { + if (strcmp(seq_cur, seqname)==0) { if (mp->curmsg) { sprintf(buffer, "%s", m_name(mp->curmsg)); return (buffer); diff --git a/sbr/seq_read.c b/sbr/seq_read.c index 3a9633e..5707dae 100644 --- a/sbr/seq_read.c +++ b/sbr/seq_read.c @@ -132,11 +132,10 @@ seq_private(struct msgs *mp) plen = strlen(mp->foldpath) + 1; for (np = m_defs; np; np = np->n_next) { - if (strncmp(np->n_name, "atr-", alen)==0 - && (j = strlen(np->n_name) - plen) > alen - && *(np->n_name + j) == '-' - && strcmp(mp->foldpath, np->n_name + j + 1) - == 0) { + if (strncmp(np->n_name, "atr-", alen)==0 && + (j = strlen(np->n_name) - plen) > alen && + *(np->n_name + j) == '-' && + strcmp(mp->foldpath, np->n_name + j + 1)==0) { cp = getcpy(np->n_name + alen); *(cp + j - alen) = '\0'; if ((i = seq_init(mp, cp, getcpy(np->n_field))) != -1) @@ -166,7 +165,7 @@ seq_init(struct msgs *mp, char *name, char *field) ** Check if this is the cur sequence, ** so we can do some special things. */ - is_current = !strcmp(seq_cur, name); + is_current = (strcmp(seq_cur, name)==0); /* ** Search for this sequence name to see if we've seen @@ -175,7 +174,7 @@ seq_init(struct msgs *mp, char *name, char *field) ** mesages in this folder. */ for (i = 0; mp->msgattrs[i]; i++) { - if (!strcmp(mp->msgattrs[i], name)) { + if (strcmp(mp->msgattrs[i], name)==0) { for (j = mp->lowmsg; j <= mp->hghmsg; j++) clear_sequence(mp, i, j); break; diff --git a/sbr/showfile.c b/sbr/showfile.c index 78eea64..594b269 100644 --- a/sbr/showfile.c +++ b/sbr/showfile.c @@ -24,7 +24,7 @@ showfile(char **arg, char *file) ** then really invoked the mhlproc instead ** (which is usually mhl anyway). */ - if (!strcmp(mhbasename(lproc), "mhl")) + if (strcmp(mhbasename(lproc), "mhl")==0) lproc = mhlproc; switch (pid = fork()) { @@ -46,7 +46,7 @@ showfile(char **arg, char *file) } } if (isdraft) { - if (!strcmp(vec[0], "show")) + if (strcmp(vec[0], "show")==0) vec[vecp++] = "-file"; vec[vecp++] = file; } diff --git a/uip/aliasbr.c b/uip/aliasbr.c index 07c5e03..85260d8 100644 --- a/uip/aliasbr.c +++ b/uip/aliasbr.c @@ -134,7 +134,8 @@ alias(char *file) register struct aka *ak = NULL; register FILE *fp; - if (*file!='/' && (strncmp(file, "./", 2) && strncmp(file, "../", 3))) + if (*file!='/' && (strncmp(file, "./", 2)!=0 && + strncmp(file, "../", 3)!=0)) file = etcpath(file); if ((fp = fopen(file, "r")) == NULL) { akerrst = file; @@ -359,7 +360,7 @@ addgroup(struct aka *ak, char *grp) struct passwd *pw; #endif /* DBMPWD */ for (hm = homehead; hm; hm = hm->h_next) - if (!strcmp(hm->h_name, gp)) { + if (strcmp(hm->h_name, gp)==0) { add_aka(ak, hm->h_name); break; } @@ -420,8 +421,8 @@ addall(struct aka *ak) Everyone = EVERYONE; for (hm = homehead; hm; hm = hm->h_next) - if (hm->h_uid > Everyone - && (noshell || strcmp(hm->h_shell, NoShell))) + if (hm->h_uid > Everyone && (noshell || + strcmp(hm->h_shell, NoShell)!=0)) add_aka(ak, hm->h_name); return homehead != NULL; @@ -466,7 +467,7 @@ add_aka(struct aka *ak, char *pp) register struct adr *ad, *ld; for (ad = ak->ak_addr, ld = NULL; ad; ld = ad, ad = ad->ad_next) - if (!strcmp(pp, ad->ad_text)) + if (strcmp(pp, ad->ad_text)==0) return; ad = (struct adr *) mh_xmalloc(sizeof(*ad)); diff --git a/uip/conflict.c b/uip/conflict.c index 82dfdcc..4a20e4b 100644 --- a/uip/conflict.c +++ b/uip/conflict.c @@ -192,7 +192,7 @@ grp_names(void) setgrent(); while ((gr = getgrent())) { for (i = 0; i < numgroups; i++) - if (!strcmp(grps[i], gr->gr_name)) { + if (strcmp(grps[i], gr->gr_name)==0) { setup(); fprintf(out, "duplicate group %s(gid=%d)\n", gr->gr_name, (int) gr->gr_gid); @@ -231,7 +231,7 @@ grp_members(void) while ((gr = getgrent())) { for (cp = gr->gr_mem; *cp; cp++) { for (hm = homehead; hm; hm = hm->h_next) - if (!strcmp(*cp, hm->h_name)) + if (strcmp(*cp, hm->h_name)==0) break; if (hm == NULL) { setup(); @@ -328,7 +328,7 @@ check(char *s) register struct home *hm; for (hm = homehead; hm; hm = hm->h_next) - if (!strcmp(s, hm->h_name)) + if (strcmp(s, hm->h_name)==0) return 1; return 0; } diff --git a/uip/dropsbr.c b/uip/dropsbr.c index cc668cd..8681277 100644 --- a/uip/dropsbr.c +++ b/uip/dropsbr.c @@ -156,7 +156,7 @@ mbx_chk_mmdf(int fd) ldelim[count] = 0; - if (strcmp(ldelim, mmdlm2) && write(fd, "\n", 1) != 1 + if (strcmp(ldelim, mmdlm2)!=0 && write(fd, "\n", 1) != 1 && write(fd, mmdlm2, count) != count) return NOTOK; @@ -361,7 +361,7 @@ mbx_copy(char *mailbox, int mbx_style, int md, int fd, int mapping, ** Change the "Return-Path:" field ** (if in first line) back to "From ". */ - if (!strncmp(buffer, "Return-Path:", 12)) { + if (strncmp(buffer, "Return-Path:", 12)==0) { char tmpbuffer[BUFSIZ]; char *tp, *ep, *fp; @@ -372,8 +372,8 @@ mbx_copy(char *mailbox, int mbx_style, int md, int fd, int mapping, fp = strchr(ep + 1, '\n'); tp = dctime(dlocaltimenow()); snprintf(buffer, sizeof(buffer), "From %.*s %s", (int)(fp - ep), ep, tp); - } else if (!strncmp(buffer, "X-Envelope-From:", - 16)) { + } else if (strncmp(buffer, "X-Envelope-From:", + 16)==0) { /* ** Change the "X-Envelope-From:" ** field (if first line) back @@ -387,7 +387,7 @@ mbx_copy(char *mailbox, int mbx_style, int md, int fd, int mapping, ep = tmpbuffer + 17; snprintf(buffer, sizeof(buffer), "From %s", ep); - } else if (strncmp(buffer, "From ", 5)) { + } else if (strncmp(buffer, "From ", 5)!=0) { /* ** If there is already a "From " ** line, then leave it alone. diff --git a/uip/flist.c b/uip/flist.c index c4d9a3b..c98a3f0 100644 --- a/uip/flist.c +++ b/uip/flist.c @@ -369,7 +369,7 @@ BuildFolderList(char *dirName, int searchdepth) ** If base directory, don't add it to the ** folder list. We just recurse into it. */ - if (!strcmp(dirName, ".")) { + if (strcmp(dirName, ".")==0) { BuildFolderListRecurse(".", &st, 0); return; } @@ -414,10 +414,11 @@ BuildFolderListRecurse(char *dirName, struct stat *s, int searchdepth) ** A hack so that we don't see a ** leading "./" in folder names. */ - base = strcmp(dirName, ".") ? dirName : dirName + 1; + base = (strcmp(dirName, ".")==0) ? dirName + 1 : dirName; while (nlinks && (dp = readdir(dir))) { - if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) { + if (strcmp(dp->d_name, ".")==0 || + strcmp(dp->d_name, "..")==0) { nlinks--; continue; } @@ -583,7 +584,7 @@ PrintFolders(void) for (j = 0; j < numsequences; j++) { if (folders[i].nSeq[j] > 0 || showzero) { /* Add `+' to end of name of current folder */ - if (strcmp(curfol, folders[i].name)) + if (strcmp(curfol, folders[i].name)!=0) snprintf(tmpname, sizeof(tmpname), "%s", folders[i].name); else @@ -652,15 +653,15 @@ AssignPriority(char *name) nl = strlen(name); for (i = 0; i < nOrders; ++i) { o = &orders[i]; - if (!strcmp(name, o->name)) + if (strcmp(name, o->name)==0) return o->priority; ol = strlen(o->name); if (nl < ol - 1) continue; if (ol < bestLen) continue; - if (o->name[0] == '*' && !strcmp(o->name + 1, - name + (nl - ol + 1))) { + if (o->name[0] == '*' && + strcmp(o->name + 1, name + (nl - ol + 1))==0) { best = o->priority; bestLen = ol; } else if (o->name[ol - 1] == '*' && diff --git a/uip/folder.c b/uip/folder.c index ae7bac5..b1398e4 100644 --- a/uip/folder.c +++ b/uip/folder.c @@ -564,7 +564,7 @@ print_folders(void) } /* Add `+' to end of name, if folder is current */ - if (strcmp(folder, fi[i].name)) + if (strcmp(folder, fi[i].name)!=0) snprintf(tmpname, sizeof(tmpname), "%s", fi[i].name); else diff --git a/uip/ftpsbr.c b/uip/ftpsbr.c index f82f51b..b37d246 100644 --- a/uip/ftpsbr.c +++ b/uip/ftpsbr.c @@ -261,9 +261,9 @@ bad: ; return NOTOK; } - istore = !strcmp(cmd, "STOR"); + istore = (strcmp(cmd, "STOR")==0); - if ((istdio = !strcmp(local, "-"))) + if ((istdio = strcmp(local, "-")==0)) fp = istore ? stdin : stdout; else if ((fp = fopen(local, istore ? "r" : "w")) == NULL) { @@ -451,7 +451,7 @@ vcommand(int complete, va_list ap) return NOTOK; } - return(getreply(complete, !strcmp(buffer, "QUIT"))); + return(getreply(complete, strcmp(buffer, "QUIT")==0)); } diff --git a/uip/mhbuild.c b/uip/mhbuild.c index bf6f646..734d8ab 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -252,7 +252,7 @@ main(int argc, char **argv) set_endian(); - if ((cp = getenv("MM_NOASK")) && !strcmp(cp, "1")) + if ((cp = getenv("MM_NOASK")) && strcmp(cp, "1")==0) listsw = 0; /* diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index ab8d99c..f65b6e3 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -1335,7 +1335,7 @@ scan_content(CT ct) if (!isspace(*cp)) break; *++cp = '\0'; - if (!strncmp(buffer + 2, prefix, len) && + if (strncmp(buffer + 2, prefix, len)==0 && isdigit(buffer[2 + len])) { boundaryclash = 1; /* no need to keep checking */ diff --git a/uip/mhmisc.c b/uip/mhmisc.c index 313719f..0c8e644 100644 --- a/uip/mhmisc.c +++ b/uip/mhmisc.c @@ -51,7 +51,7 @@ part_ok(CT ct, int sP) for (ap = parts; *ap; ap++) { len = strlen(*ap); - if (!strncmp(*ap, ct->c_partno, len) && + if (strncmp(*ap, ct->c_partno, len)==0 && (!ct->c_partno[len] || ct->c_partno[len] == '.' )) return 1; diff --git a/uip/mhparse.c b/uip/mhparse.c index 1ac7ea9..f667713 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -199,7 +199,7 @@ parse_mime(char *file) /* ** Check if file is actually standard input */ - if ((is_stdin = !(strcmp(file, "-")))) { + if ((is_stdin = (strcmp(file, "-")==0))) { char *tfile = m_mktemp2(NULL, invo_name, NULL, &fp); if (tfile == NULL) { advise("mhparse", "unable to create temporary file"); @@ -1197,7 +1197,7 @@ InitMultiPart(CT ct) if (buffer[0] != '-' || buffer[1] != '-') continue; if (inout) { - if (strcmp(buffer + 2, m->mp_start)) + if (strcmp(buffer + 2, m->mp_start)!=0) continue; next_part: if ((part = (struct part *) calloc(1, sizeof(*part))) diff --git a/uip/mhshow.c b/uip/mhshow.c index 5d5ac3e..b1f3d3d 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -295,7 +295,7 @@ do_cache: set_endian(); - if ((cp = getenv("MM_NOASK")) && !strcmp(cp, "1")) { + if ((cp = getenv("MM_NOASK")) && strcmp(cp, "1")==0) { nolist = 1; pausesw = 0; } diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 8fed651..ee401a7 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -110,7 +110,7 @@ show_all_messages(CT *cts) /* ** If form is "mhl.null", suppress display of header. */ - if (!strcmp(formsw, "mhl.null")) + if (strcmp(formsw, "mhl.null")==0) formsw = NULL; for (ctp = cts; *ctp; ctp++) { @@ -348,7 +348,7 @@ show_content_aux(CT ct, int serial, int alternate, char *cp, char *cracked) file = NULL; if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK) return NOTOK; - if (ct->c_showproc && !strcmp(ct->c_showproc, "true")) + if (ct->c_showproc && strcmp(ct->c_showproc, "true")==0) return (alternate ? DONE : OK); xlist = 0; @@ -884,7 +884,7 @@ show_multi_aux(CT ct, int serial, int alternate, char *cp) /* I'm not sure if this is necessary? */ p->c_storage = getcpy(file); - if (p->c_showproc && !strcmp(p->c_showproc, "true")) + if (p->c_showproc && strcmp(p->c_showproc, "true")==0) return (alternate ? DONE : OK); (*p->c_ceclosefnx) (p); } diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index 0afcc99..0b1a9b3 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -632,14 +632,15 @@ got_filename: if (ct->c_folder) { fprintf(stderr, " to folder %s as message %d\n", ct->c_folder, msgnum); - } else if (!strcmp(ct->c_storage, "-")) { + } else if (strcmp(ct->c_storage, "-")==0) { fprintf(stderr, " to stdout\n"); } else { int cwdlen; cwdlen = strlen(cwd); fprintf(stderr, " as file %s\n", - strncmp(ct->c_storage, cwd, cwdlen) || + strncmp(ct->c_storage, cwd, + cwdlen)!=0 || ct->c_storage[cwdlen] != '/' ? ct->c_storage : ct->c_storage + cwdlen + 1); @@ -678,11 +679,11 @@ output_content_file(CT ct, int appending) return NOTOK; } - file = appending || !strcmp(ct->c_storage, "-") ? + file = appending || strcmp(ct->c_storage, "-")==0 ? NULL : ct->c_storage; if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK) return NOTOK; - if (!strcmp(file, ct->c_storage)) { + if (strcmp(file, ct->c_storage)==0) { (*ct->c_ceclosefnx) (ct); return OK; } @@ -690,7 +691,7 @@ output_content_file(CT ct, int appending) /* ** Send to standard output */ - if (!strcmp(ct->c_storage, "-")) { + if (strcmp(ct->c_storage, "-")==0) { int gd; if ((gd = dup(fileno(stdout))) == NOTOK) { @@ -763,7 +764,7 @@ losing: last = ct->c_end; fseek(ct->c_fp, pos, SEEK_SET); - if (!strcmp(ct->c_storage, "-")) { + if (strcmp(ct->c_storage, "-")==0) { int gd; if ((gd = dup(fileno(stdout))) == NOTOK) { diff --git a/uip/rmf.c b/uip/rmf.c index 48a555e..374d752 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -113,7 +113,7 @@ main(int argc, char **argv) if (rmf(folder) == OK) { char *cfolder = context_find(curfolder); - if (cfolder && strcmp(cfolder, newfolder)) { + if (cfolder && strcmp(cfolder, newfolder)!=0) { printf("[+%s now current]\n", newfolder); /* update current folder */ context_replace(curfolder, newfolder); diff --git a/uip/show.c b/uip/show.c index 999272b..e7ecb72 100644 --- a/uip/show.c +++ b/uip/show.c @@ -335,7 +335,7 @@ go_to_it: ; ** add the path to the message names. Currently, we are just ** checking for mhn here, since we've already taken care of mhl. */ - if (!strcmp(mhbasename(proc), "mhl") + if (strcmp(mhbasename(proc), "mhl")==0 && !file && chdir(maildir = concat(toabsdir("+"), "/", NULL)) != NOTOK) { diff --git a/uip/slocal.c b/uip/slocal.c index 2ac93d1..85bc52a 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -1369,7 +1369,7 @@ you_lose: while (fgets(buffer, sizeof(buffer), qfp)) { if (first) { first = 0; - if (!strncmp(buffer, "From ", i)) { + if (strncmp(buffer, "From ", i)==0) { #ifdef RPATHS char *fp, *cp, *hp, *ep; #endif diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index 0699fce..8eeed10 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -828,7 +828,7 @@ sendfile(char **arg, char *file, int pushsw) char *cp, *sp, *vec[MAXARGS]; /* Translate MIME composition file, if necessary */ - if ((cp = context_find("automimeproc")) && (!strcmp(cp, "1")) && + if ((cp = context_find("automimeproc")) && (strcmp(cp, "1")==0) && !getenv("NOMHNPROC") && check_draft(file) && (buildfile(NULL, file) == NOTOK)) return 0;