From: David Levine Date: Sun, 24 Mar 2013 18:37:47 +0000 (-0500) Subject: Finished replacing mh_strcasecmp() with strcasecmp(). Removed X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/17b9beb40640e8731143f61e3b94756f3e77d20c?ds=sidebyside;hp=d66378909931a74ed83e29d592982eaa3e7e0107 Finished replacing mh_strcasecmp() with strcasecmp(). Removed sbr/strcasecmp.c. --- diff --git a/Makefile.am b/Makefile.am index 1e64f159..338bba38 100644 --- a/Makefile.am +++ b/Makefile.am @@ -544,7 +544,7 @@ sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/arglist.c \ sbr/seq_print.c sbr/seq_read.c sbr/seq_save.c \ sbr/seq_setcur.c sbr/seq_setprev.c sbr/seq_setunseen.c \ sbr/showfile.c sbr/signals.c sbr/smatch.c \ - sbr/snprintb.c sbr/ssequal.c sbr/strcasecmp.c \ + sbr/snprintb.c sbr/ssequal.c \ sbr/strindex.c sbr/trimcpy.c sbr/uprf.c sbr/vfgets.c \ sbr/fmt_def.c sbr/mf.c sbr/utils.c sbr/ctype-checked.c \ sbr/m_mktemp.c sbr/getansreadline.c config/config.c \ diff --git a/h/prototypes.h b/h/prototypes.h index 484bef28..8fa31576 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -194,9 +194,6 @@ int uprf (char *, char *); int vfgets (FILE *, char **); char *write_charset_8bit (void); -int mh_strcasecmp (const char *s1, const char *s2); -int strncasecmp (const char *s1, const char *s2, size_t n); - /* * some prototypes for address parsing system diff --git a/sbr/message_id.c b/sbr/message_id.c index bb713130..ce65ed9c 100644 --- a/sbr/message_id.c +++ b/sbr/message_id.c @@ -23,10 +23,10 @@ static char message_id_[BUFSIZ]; /* Convert name of message id style to integer value and store it. */ int save_message_id_style (const char *value) { - if (! mh_strcasecmp (value, "localname")) { + if (! strcasecmp (value, "localname")) { message_id_style = NMH_MESSAGE_ID_LOCALNAME; return 0; - } else if (! mh_strcasecmp (value, "random")) { + } else if (! strcasecmp (value, "random")) { message_id_style = NMH_MESSAGE_ID_RANDOM; return 0; } else { diff --git a/sbr/mts.c b/sbr/mts.c index 70dae024..f498615c 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -125,14 +125,14 @@ static struct bind binds[] = { /* Convert name of mts method to integer value and store it. */ void save_mts_method (const char *value) { - if (! mh_strcasecmp (value, "smtp")) { + if (! strcasecmp (value, "smtp")) { mts_method = "smtp"; sm_mts = MTS_SMTP; - } else if (! mh_strcasecmp (value, "sendmail/smtp") || - ! mh_strcasecmp (value, "sendmail")) { + } else if (! strcasecmp (value, "sendmail/smtp") || + ! strcasecmp (value, "sendmail")) { mts_method = "sendmail/smtp"; sm_mts = MTS_SENDMAIL_SMTP; - } else if (! mh_strcasecmp (value, "sendmail/pipe")) { + } else if (! strcasecmp (value, "sendmail/pipe")) { mts_method = "sendmail/pipe"; sm_mts = MTS_SENDMAIL_PIPE; } else { diff --git a/sbr/readconfig.c b/sbr/readconfig.c index be458239..866747a2 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -143,7 +143,7 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx) if (strlen (np->n_name) > 0 && strcmp ("#", np->n_name)) { struct node *np2; for (np2 = np->n_next; np2; np2 = np2->n_next) { - if (! mh_strcasecmp (np->n_name, np2->n_name)) { + if (! strcasecmp (np->n_name, np2->n_name)) { admonish (NULL, "multiple \"%s\" profile components " "in %s, ignoring \"%s\"", np->n_name, defpath, np2->n_field); diff --git a/sbr/strcasecmp.c b/sbr/strcasecmp.c deleted file mode 100644 index c48c9d4c..00000000 --- a/sbr/strcasecmp.c +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * strcasecmp.c -- compare strings, ignoring case - * - * This code is Copyright (c) 2002, by the authors of nmh. See the - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ - -#include - -/* - * Our version of strcasecmp has to deal with NULL strings. - * Once that is fixed in the rest of the code, we can use the - * native version, instead of this one. - */ - -int -mh_strcasecmp (const char *s1, const char *s2) -{ - const unsigned char *us1, *us2; - - us1 = (const unsigned char *) s1, - us2 = (const unsigned char *) s2; - - if (!us1) - us1 = (const unsigned char *) ""; - if (!us2) - us2 = (const unsigned char *) ""; - - while (tolower(*us1) == tolower(*us2++)) - if (*us1++ == '\0') - return (0); - return (tolower(*us1) - tolower(*--us2)); -} - - -int -mh_strncasecmp (const char *s1, const char *s2, size_t n) -{ - const unsigned char *us1, *us2; - - if (n != 0) { - us1 = (const unsigned char *) s1, - us2 = (const unsigned char *) s2; - - do { - if (tolower(*us1) != tolower(*us2++)) - return (tolower(*us1) - tolower(*--us2)); - if (*us1++ == '\0') - break; - } while (--n != 0); - } - return (0); -}