diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-07-07 14:47:04 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-07-07 14:47:04 +0300 |
commit | 4fe47925e890ad37d75e4ad5fa75d68a48419176 (patch) | |
tree | 7bc79722eccbe100136ffda392fe69a43bcd1e35 /examples | |
parent | 56d50498700d28bb7bf3bab5e23973d29669e101 (diff) | |
download | mailutils-4fe47925e890ad37d75e4ad5fa75d68a48419176.tar.gz mailutils-4fe47925e890ad37d75e4ad5fa75d68a48419176.tar.bz2 |
Introduce locale-independent character type and string functions.
* include/mailutils/cctype.h: New file.
* include/mailutils/cstr.h: New file.
* include/mailutils/Makefile.am: Add new files.
* mailbox/cstrcasecmp.c: New file.
* mailbox/cstrlower.c: New file.
* mailbox/cstrupper.c: New file.
* mailbox/muctype.c: New file.
* mailbox/strltrim.c: New file.
* mailbox/strrtrim.c: New file.
* mailbox/strskip.c: New file.
* mailbox/Makefile.am: Add new files.
* .gitignore: Update
* gnulib.modules: Remove strcase.
* comsat/comsat.h, imap4d/imap4d.h, include/mailutils/mailutils.h,
include/mailutils/mutil.h, include/mailutils/sys/pop3.h,
libmu_scm/mu_scm.h, mail/mail.h: Include cstr.h and cctype.h.
* comsat/oldcfg.c, config/mailutils-config.c,
examples/mimetest.c, examples/mta.c, examples/nntpclient.c,
examples/pop3client.c, imap4d/append.c, imap4d/create.c,
imap4d/delete.c, imap4d/fetch.c, imap4d/id.c,
imap4d/idle.c, imap4d/list.c, imap4d/namespace.c,
imap4d/rename.c, imap4d/search.c, imap4d/status.c,
imap4d/store.c, imap4d/uid.c, imap4d/util.c,
libmu_argp/compat.c, libmu_auth/ldap.c,
libmu_auth/sql.c, libmu_scm/mu_message.c,
libmu_sieve/actions.c, libmu_sieve/comparator.c,
libmu_sieve/extensions/list.c, libmu_sieve/extensions/spamd.c,
libmu_sieve/extensions/vacation.c, libmu_sieve/load.c,
libmu_sieve/sieve.l, libmu_sieve/tests.c,
libproto/imap/folder.c, libproto/mailer/smtp.c,
libproto/mbox/mbox.c, libproto/mh/folder.c,
libproto/mh/mbox.c, libproto/pop/folder.c,
libproto/pop/mbox.c, libproto/pop/pop3_connect.c,
maidag/forward.c, maidag/lmtp.c, maidag/maidag.c,
maidag/maidag.h, maidag/mailquota.c, mail/alt.c,
mail/copy.c, mail/decode.c, mail/escape.c,
mail/followup.c, mail/mail.c, mail/mailline.c,
mail/msgset.y, mail/print.c, mail/reply.c,
mail/send.c, mail/shell.c, mail/util.c,
mail/write.c, mailbox/address.c,
mailbox/amd.c, mailbox/assoc.c,
mailbox/attachment.c, mailbox/attribute.c,
mailbox/cfg_lexer.l, mailbox/date.c,
mailbox/filter.c, mailbox/gdebug.c,
mailbox/header.c, mailbox/kwd.c,
mailbox/locale.c, mailbox/mailcap.c,
mailbox/mailer.c, mailbox/message.c,
mailbox/message_stream.c, mailbox/mime.c,
mailbox/msrv.c, mailbox/mutil.c,
mailbox/parse822.c, mailbox/progmailer.c,
mailbox/rfc2047.c, mailbox/syslog.c, mailbox/url.c,
mailbox/version.c, mh/mh.h, mh/mh_alias.l,
mh/mh_ctx.c, mh/mh_fmtgram.y, mh/mh_init.c,
mh/mh_list.c, mh/mh_msgset.c, mh/mh_sequence.c,
mh/mh_whatnow.c, mh/mh_whom.c, mh/mhn.c,
mh/mhparam.c, mh/pick.y, mh/sortm.c,
mimeview/mimetypes.y, pop3d/bulletin.c,
pop3d/expire.c, pop3d/pop3d.c, pop3d/pop3d.h,
pop3d/popauth.c, pop3d/user.c, readmsg/msglist.c,
readmsg/readmsg.c, readmsg/readmsg.h, sql/mysql.c,
sql/postgres.c: Use locale-independent cclass and str functions.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/mimetest.c | 9 | ||||
-rw-r--r-- | examples/mta.c | 13 | ||||
-rw-r--r-- | examples/nntpclient.c | 33 | ||||
-rw-r--r-- | examples/pop3client.c | 14 |
4 files changed, 36 insertions, 33 deletions
diff --git a/examples/mimetest.c b/examples/mimetest.c index ef12a40da..488bb3194 100644 --- a/examples/mimetest.c +++ b/examples/mimetest.c @@ -1,5 +1,6 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 1999, 2000, 2001, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2005, 2007, + 2009 Free Software Foundation, Inc. GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -199,7 +200,7 @@ message_display_parts (mu_message_t msg, int indent) encoding = ""; ismulti = 0; if ((type[0] - && strncasecmp (type, "message/rfc822", strlen (type)) == 0) + && mu_c_strncasecmp (type, "message/rfc822", strlen (type)) == 0) || (mu_message_is_multipart (part, &ismulti) == 0 && ismulti)) { if (!ismulti) @@ -218,9 +219,9 @@ message_display_parts (mu_message_t msg, int indent) mu_message_destroy (&part, NULL); } else if (type[0] == '\0' - || (strncasecmp (type, "text/plain", strlen ("text/plain")) == + || (mu_c_strncasecmp (type, "text/plain", strlen ("text/plain")) == 0) - || (strncasecmp (type, "text/html", strlen ("text/html")) == + || (mu_c_strncasecmp (type, "text/html", strlen ("text/html")) == 0)) { printf ("%*.*sText Message\n", indent, indent, ""); diff --git a/examples/mta.c b/examples/mta.c index 0e84180cc..226aab286 100644 --- a/examples/mta.c +++ b/examples/mta.c @@ -1,5 +1,6 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 1999, 2000, 2001, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2005, 2007, + 2009 Free Software Foundation, Inc. GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -537,7 +538,7 @@ smtp_kw (const char *name) int i; for (i = 0; kw[i].name != NULL; i++) - if (strcasecmp (name, kw[i].name) == 0) + if (mu_c_strcasecmp (name, kw[i].name) == 0) return kw[i].code; return -1; } @@ -546,7 +547,7 @@ static char * check_prefix (char *str, const char *prefix) { int pflen = strlen (prefix); - if (strlen (str) > pflen && strncasecmp (str, prefix, pflen) == 0) + if (strlen (str) > pflen && mu_c_strncasecmp (str, prefix, pflen) == 0) return str + pflen; else return NULL; @@ -622,7 +623,7 @@ smtp (int fd) case KW_MAIL: if (argc == 2) from_person = check_prefix (argv[1], "from:"); - else if (argc == 3 && strcasecmp (argv[1], "from:") == 0) + else if (argc == 3 && mu_c_strcasecmp (argv[1], "from:") == 0) from_person = argv[2]; else from_person = NULL; @@ -648,7 +649,7 @@ smtp (int fd) case KW_RCPT: if (argc == 2) rcpt_addr = check_prefix (argv[1], "to:"); - else if (argc == 3 && strcasecmp (argv[1], "to:") == 0) + else if (argc == 3 && mu_c_strcasecmp (argv[1], "to:") == 0) rcpt_addr = argv[2]; else rcpt_addr = NULL; @@ -678,7 +679,7 @@ smtp (int fd) case KW_RCPT: if (argc == 2) rcpt_addr = check_prefix (argv[1], "to:"); - else if (argc == 3 && strcasecmp (argv[1], "to:") == 0) + else if (argc == 3 && mu_c_strcasecmp (argv[1], "to:") == 0) rcpt_addr = argv[2]; else rcpt_addr = NULL; diff --git a/examples/nntpclient.c b/examples/nntpclient.c index 61d4b65d6..6d4a6bc70 100644 --- a/examples/nntpclient.c +++ b/examples/nntpclient.c @@ -2,7 +2,7 @@ GNU Mailutils nntp functions. This application interactively allows users to contact a nntp server. - Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation + Copyright (C) 2003, 2004, 2005, 2007, 2009 Free Software Foundation GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,6 @@ #include <stdlib.h> #include <termios.h> #include <signal.h> -#include <ctype.h> #include <time.h> #ifdef WITH_READLINE @@ -43,6 +42,8 @@ #include <mailutils/iterator.h> #include <mailutils/error.h> #include <mailutils/errno.h> +#include <mailutils/mutil.h> +#include <mailutils/cctype.h> /* A structure which contains information on the commands this program can understand. */ @@ -299,11 +300,11 @@ execute_line (char *line) /* Isolate the command word. */ i = 0; - while (line[i] && isspace (line[i])) + while (line[i] && mu_isblank (line[i])) i++; word = line + i; - while (line[i] && !isspace (line[i])) + while (line[i] && !mu_isblank (line[i])) i++; if (line[i]) @@ -318,7 +319,7 @@ execute_line (char *line) } /* Get argument to command, if any. */ - while (isspace (line[i])) + while (mu_isblank (line[i])) i++; word = line + i; @@ -349,14 +350,14 @@ stripwhite (char *string) { register char *s, *t; - for (s = string; isspace (*s); s++) + for (s = string; mu_isblank (*s); s++) ; if (*s == 0) return (s); t = s + strlen (s) - 1; - while (t > s && isspace (*t)) + while (t > s && mu_isblank (*t)) t--; *++t = '\0'; @@ -392,7 +393,7 @@ int com_mode (char *arg) { if (!valid_argument("mode", arg)) return EINVAL; - if (strncasecmp (arg, "READER", 6) == 0) + if (mu_c_strncasecmp (arg, "READER", 6) == 0) return com_mode_reader (arg); return EINVAL; } @@ -533,27 +534,27 @@ int com_list (char *arg) { status = com_list_active (arg); } - else if (strncasecmp (keyword, "ACTIVE.TIMES", 12) == 0) + else if (mu_c_strncasecmp (keyword, "ACTIVE.TIMES", 12) == 0) { status = com_list_active_times (arg); } - else if (strncasecmp (keyword, "ACTIVE", 6) == 0) + else if (mu_c_strncasecmp (keyword, "ACTIVE", 6) == 0) { status = com_list_active (arg); } - else if (strncasecmp (keyword, "EXTENSIONS", 10) == 0) + else if (mu_c_strncasecmp (keyword, "EXTENSIONS", 10) == 0) { status = com_list_extensions (arg); } - else if (strncasecmp (keyword, "DISTRIBUTIONS", 13) == 0) + else if (mu_c_strncasecmp (keyword, "DISTRIBUTIONS", 13) == 0) { status = com_list_distributions (arg); } - else if (strncasecmp (keyword, "DISTRIB.PATS", 12) == 0) + else if (mu_c_strncasecmp (keyword, "DISTRIB.PATS", 12) == 0) { status = com_list_distrib_pats (arg); } - else if (strncasecmp (keyword, "NEWSGROUPS", 10) == 0) + else if (mu_c_strncasecmp (keyword, "NEWSGROUPS", 10) == 0) { status = com_list_newsgroups (arg); } @@ -806,7 +807,7 @@ com_newgroups (char *arg) char gmt[4]; memset (gmt, 0, 4); sscanf (arg, "%4d%2d%2d %2d%2d%2d %3s", &year, &month, &day, &hour, &min, &sec, gmt); - is_gmt = strncasecmp ("GMT", gmt, 3) == 0; + is_gmt = mu_c_strncasecmp ("GMT", gmt, 3) == 0; } /* If nothing defined take the current time. */ @@ -865,7 +866,7 @@ com_newnews (char *arg) wildmat = calloc (1, 512); sscanf (arg, "%511s %4d%2d%2d %2d%2d%2d %3s", wildmat, &year, &month, &day, &hour, &min, &sec, gmt); - is_gmt = strncasecmp ("GMT", gmt, 3) == 0; + is_gmt = mu_c_strncasecmp ("GMT", gmt, 3) == 0; if (year == 0) { diff --git a/examples/pop3client.c b/examples/pop3client.c index 7f1d8e6bf..e4367c9e7 100644 --- a/examples/pop3client.c +++ b/examples/pop3client.c @@ -2,7 +2,7 @@ GNU Mailutils pop3 functions. This application interactively allows users to contact a pop3 server. - Copyright (C) 2003, 2004, 2005, 2007, 2008 Free Software Foundation + Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,7 +33,6 @@ #include <stdlib.h> #include <termios.h> #include <signal.h> -#include <ctype.h> #ifdef WITH_READLINE # include <readline/readline.h> @@ -46,6 +45,7 @@ #include <mailutils/errno.h> #include <mailutils/vartab.h> #include <mailutils/argcv.h> +#include <mailutils/cctype.h> /* A structure which contains information on the commands this program can understand. */ @@ -348,11 +348,11 @@ execute_line (char *line) /* Isolate the command word. */ i = 0; - while (line[i] && isspace (line[i])) + while (line[i] && mu_isblank (line[i])) i++; word = line + i; - while (line[i] && !isspace (line[i])) + while (line[i] && !mu_isblank (line[i])) i++; if (line[i]) @@ -367,7 +367,7 @@ execute_line (char *line) } /* Get argument to command, if any. */ - while (isspace (line[i])) + while (mu_isblank (line[i])) i++; word = line + i; @@ -398,14 +398,14 @@ stripwhite (char *string) { register char *s, *t; - for (s = string; isspace (*s); s++) + for (s = string; mu_isblank (*s); s++) ; if (*s == 0) return (s); t = s + strlen (s) - 1; - while (t > s && isspace (*t)) + while (t > s && mu_isblank (*t)) t--; *++t = '\0'; |