bin_PROGRAMS = mutt $(PGPAUX_TARGET)
-mutt_SOURCES = account.c addrbook.c address.h alias.c alias.h ascii.c attach.c \
+mutt_SOURCES = account.c addrbook.c address.h alias.c alias.h attach.c \
base64.c bcache.c body.h browser.c buffer.c buffy.c charset.c color.c \
commands.c complete.c compose.c compress.c content.h context.h copy.c \
curs_lib.c curs_main.c date.c edit.c editmsg.c enter.c enter_state.h \
mutt_lua.c mutt_sasl.c mutt_notmuch.c mutt_ssl.c mutt_ssl_gnutls.c \
remailer.c remailer.h resize.c sha1.c url.h utf8.c wcwidth.c
-EXTRA_DIST = account.h ascii.h attach.h bcache.h browser.h buffer.h buffy.h \
+EXTRA_DIST = account.h attach.h bcache.h browser.h buffer.h buffy.h \
ChangeLog.md charset.h CODE_OF_CONDUCT.md compress.h copy.h \
COPYRIGHT extlib.c filter.h functions.h gen_defs globals.h \
group.h hash.h history.h init.h keymap.h lib.h LICENSE.md mailbox.h \
EXTRA_SCRIPTS =
-pgpring_SOURCES = ascii.c extlib.c lib.c md5.c pgppubring.c sha1.c
+pgpring_SOURCES = extlib.c lib.c md5.c pgppubring.c sha1.c
pgpring_LDADD = $(LIBOBJS) $(NCRYPT_LIBS) $(INTLLIBS) $(LIBLIB)
pgpring_DEPENDENCIES = $(LIBOBJS) $(NCRYPT_DEPS) $(INTLDEPS) $(LIBLIBDEPS)
#include <string.h>
#include "mutt.h"
#include "account.h"
-#include "ascii.h"
#include "globals.h"
#include "lib.h"
#include "lib/lib.h"
#include <stdlib.h>
#include "address.h"
#include "alias.h"
-#include "ascii.h"
#include "format_flags.h"
#include "globals.h"
#include "keymap.h"
#include "mutt.h"
#include "alias.h"
#include "address.h"
-#include "ascii.h"
#include "charset.h"
#include "envelope.h"
#include "globals.h"
#include <unistd.h>
#include "mutt.h"
#include "attach.h"
-#include "ascii.h"
#include "body.h"
#include "context.h"
#include "copy.h"
#include <string.h>
#include "mutt.h"
#include "charset.h"
-#include "ascii.h"
#include "globals.h"
#include "lib.h"
#include "lib/lib.h"
#include <stdlib.h>
#include <string.h>
#include "mutt.h"
-#include "ascii.h"
#include "buffer.h"
#include "context.h"
#include "globals.h"
#include <unistd.h>
#include "mutt.h"
#include "alias.h"
-#include "ascii.h"
#include "body.h"
#include "buffer.h"
#include "buffy.h"
#include "mutt.h"
#include "copy.h"
#include "address.h"
-#include "ascii.h"
#include "body.h"
#include "context.h"
#include "envelope.h"
#include <stdio.h>
#include <string.h>
#include <time.h>
-#include "ascii.h"
#include "globals.h"
#include "lib.h"
#include "lib/lib.h"
#include <wchar.h>
#include <wctype.h>
#include "mutt.h"
-#include "ascii.h"
#include "body.h"
#include "charset.h"
#include "copy.h"
#include <time.h>
#include "mutt.h"
#include "alias.h"
-#include "ascii.h"
#include "body.h"
#include "context.h"
#include "envelope.h"
#include "config.h"
#include <string.h>
#include "auth.h"
-#include "ascii.h"
#include "globals.h"
#include "lib.h"
#include "lib/lib.h"
#include <string.h>
#include "imap_private.h"
#include "account.h"
-#include "ascii.h"
#include "auth.h"
#include "globals.h"
#include "lib.h"
if (mutt_bit_isset(idata->capabilities, AUTH_ANON) &&
(!idata->conn->account.user[0] ||
- (ascii_strncmp(idata->conn->account.user, "anonymous", 9) == 0)))
+ (mutt_strncmp(idata->conn->account.user, "anonymous", 9) == 0)))
rc = sasl_client_start(saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen, &mech);
}
else if ((ascii_strcasecmp("login", method) == 0) &&
#include <time.h>
#include "imap_private.h"
#include "account.h"
-#include "ascii.h"
#include "buffer.h"
#include "buffy.h"
#include "context.h"
value = imap_next_word(s);
count = strtol(value, &value, 10);
- if (ascii_strncmp("MESSAGES", s, 8) == 0)
+ if (mutt_strncmp("MESSAGES", s, 8) == 0)
{
status->messages = count;
new_msg_count = 1;
}
- else if (ascii_strncmp("RECENT", s, 6) == 0)
+ else if (mutt_strncmp("RECENT", s, 6) == 0)
status->recent = count;
- else if (ascii_strncmp("UIDNEXT", s, 7) == 0)
+ else if (mutt_strncmp("UIDNEXT", s, 7) == 0)
status->uidnext = count;
- else if (ascii_strncmp("UIDVALIDITY", s, 11) == 0)
+ else if (mutt_strncmp("UIDVALIDITY", s, 11) == 0)
status->uidvalidity = count;
- else if (ascii_strncmp("UNSEEN", s, 6) == 0)
+ else if (mutt_strncmp("UNSEEN", s, 6) == 0)
status->unseen = count;
s = value;
idata->lastread = time(NULL);
/* handle untagged messages. The caller still gets its shot afterwards. */
- if (((ascii_strncmp(idata->buf, "* ", 2) == 0) ||
- (ascii_strncmp(imap_next_word(idata->buf), "OK [", 4) == 0)) &&
+ if (((mutt_strncmp(idata->buf, "* ", 2) == 0) ||
+ (mutt_strncmp(imap_next_word(idata->buf), "OK [", 4) == 0)) &&
cmd_handle_untagged(idata))
return IMAP_CMD_BAD;
cmd = &idata->cmds[c];
if (cmd->state == IMAP_CMD_NEW)
{
- if (ascii_strncmp(idata->buf, cmd->seq, SEQLEN) == 0)
+ if (mutt_strncmp(idata->buf, cmd->seq, SEQLEN) == 0)
{
if (!stillrunning)
{
#include "mutt.h"
#include "imap.h"
#include "account.h"
-#include "ascii.h"
#include "bcache.h"
#include "body.h"
#include "buffer.h"
strfcpy(mailbox, "INBOX", sizeof(mailbox));
/* we may already be in the folder we're checking */
- if (ascii_strcmp(idata->mailbox, mx.mbox) == 0)
+ if (mutt_strcmp(idata->mailbox, mx.mbox) == 0)
{
FREE(&mx.mbox);
return 0;
if (ascii_strncasecmp(flag_list->data, flag, strlen(flag_list->data)) == 0)
return true;
- if (ascii_strncmp(flag_list->data, "\\*", strlen(flag_list->data)) == 0)
+ if (mutt_strncmp(flag_list->data, "\\*", strlen(flag_list->data)) == 0)
return true;
flag_list = flag_list->next;
#include "mutt.h"
#include "message.h"
#include "account.h"
-#include "ascii.h"
#include "bcache.h"
#include "body.h"
#include "buffer.h"
#include "imap_private.h"
#include "mutt.h"
#include "account.h"
-#include "ascii.h"
#include "bcache.h"
#include "buffer.h"
#include "context.h"
mx->account.flags |= MUTT_ACCT_PORT;
if (sscanf(tmp, "/%s", tmp) == 1)
{
- if (ascii_strncmp(tmp, "ssl", 3) == 0)
+ if (mutt_strncmp(tmp, "ssl", 3) == 0)
mx->account.flags |= MUTT_ACCT_SSL;
else
{
#include "init.h"
#include "address.h"
#include "alias.h"
-#include "ascii.h"
#include "buffer.h"
#include "charset.h"
#include "context.h"
#include <stdlib.h>
#include <string.h>
#include "keymap.h"
-#include "ascii.h"
#include "buffer.h"
#include "functions.h"
#include "globals.h"
AUTOMAKE_OPTIONS = 1.6 foreign
-EXTRA_DIST = lib.h
+EXTRA_DIST = lib.h lib_ascii.h
AM_CPPFLAGS = -I$(top_srcdir)
noinst_LIBRARIES = liblib.a
noinst_HEADERS =
-liblib_a_SOURCES =
+liblib_a_SOURCES = lib_ascii.c
* The library is self-contained -- some files may depend on others in the
* library, but none depends on source from outside.
*
+ * -# @subpage ascii
*/
#ifndef _LIB_LIB_H
#define _LIB_LIB_H
+#include "lib_ascii.h"
#endif /* _LIB_LIB_H */
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * @page ascii ASCII string comparison routines
+ *
+ * Simple ASCII string comparisons.
+ *
+ * | Function | Description
+ * | :------------------ | :---------------------------------
+ * | ascii_strcasecmp() | Compare strings, ignoring the case
+ * | ascii_strlower() | Lowercase a string
+ * | ascii_strncasecmp() | Compare strings, ignoring the case
+ */
/*
* Versions of the string comparison functions which are
*/
#include "config.h"
+#include <ctype.h>
#include <stdio.h>
-#include "ascii.h"
+#include "lib_ascii.h"
+/**
+ * ascii_strcasecmp - Compare strings, ignoring the case
+ * @param a First string to compare
+ * @param b Second string to compare
+ * @retval -1 a precedes b
+ * @retval 0 a and b are identical
+ * @retval 1 b precedes a
+ */
int ascii_strcasecmp(const char *a, const char *b)
{
- int i;
-
if (a == b)
return 0;
if (a == NULL && b)
for (;; a++, b++)
{
- if ((i = tolower(*a) - tolower(*b)))
+ int i = tolower(*a) - tolower(*b);
+ if (i)
return i;
- /* test for NUL here rather that in the for loop in order to detect unequal
- * length strings (see http://dev.mutt.org/trac/ticket/3601)
- */
+ /* test for NUL here rather than in the for loop in order to detect unequal
+ * length strings */
if (!*a)
break;
}
return 0;
}
+/**
+ * ascii_strncasecmp - Compare strings, ignoring the case
+ * @param a First string to compare
+ * @param b Second string to compare
+ * @param n Maximum number of characters to compare
+ * @retval -1 a precedes b
+ * @retval 0 a and b are identical
+ * @retval 1 b precedes a
+ */
int ascii_strncasecmp(const char *a, const char *b, int n)
{
- int i;
-
if (a == b)
return 0;
if (a == NULL && b)
for (int j = 0; (*a || *b) && j < n; a++, b++, j++)
{
- if ((i = tolower(*a) - tolower(*b)))
+ int i = tolower(*a) - tolower(*b);
+ if (i)
return i;
}
return 0;
}
+
+/**
+ * ascii_strlower - Lowercase a string
+ * @param s String to transform
+ * @retval ptr Transformed string
+ *
+ * The string is transformed in place.
+ */
+char *ascii_strlower(char *s)
+{
+ char *p = s;
+
+ for (; *p; ++p)
+ *p = tolower(*p);
+
+ return s;
+}
*/
/*
- * Versions of the string comparison functions which are
- * locale-insensitive.
+ * Versions of the string comparison functions which are locale-insensitive.
*/
-#ifndef _MUTT_ASCII_H
-#define _MUTT_ASCII_H
-
-#include <ctype.h>
+#ifndef _LIB_ASCII_H
+#define _LIB_ASCII_H
int ascii_strcasecmp(const char *a, const char *b);
int ascii_strncasecmp(const char *a, const char *b, int n);
+char *ascii_strlower(char *s);
-#define ascii_strcmp(a, b) mutt_strcmp(a, b)
-#define ascii_strncmp(a, b, c) mutt_strncmp(a, b, c)
-
-static inline char *ascii_strlower(char *s)
-{
- char *p = s;
-
- for (; *p; ++p)
- {
- *p = tolower(*p);
- }
-
- return s;
-}
-
-#endif /* _MUTT_ASCII_H */
+#endif /* _LIB_ASCII_H */
#include "mutt.h"
#include "address.h"
#include "alias.h"
-#include "ascii.h"
#include "body.h"
#include "buffy.h"
#include "envelope.h"
#include <string.h>
#include <wchar.h>
#include "mbyte.h"
-#include "ascii.h"
#include "buffer.h"
#include "charset.h"
#include "lib.h"
#include <string.h>
#include "mutt_idna.h"
#include "address.h"
-#include "ascii.h"
#include "charset.h"
#include "envelope.h"
#include "globals.h"
#include "mutt.h"
#include "address.h"
#include "alias.h"
-#include "ascii.h"
#include "body.h"
#include "buffer.h"
#include "charset.h"
#include "mutt.h"
#include "mx.h"
#include "address.h"
-#include "ascii.h"
#include "body.h"
#include "buffy.h"
#include "context.h"
#include "mutt.h"
#include "address.h"
#include "alias.h"
-#include "ascii.h"
#include "body.h"
#include "content.h"
#include "context.h"
#include "mutt.h"
#include "address.h"
#include "alias.h"
-#include "ascii.h"
#include "body.h"
#include "charset.h"
#include "crypt.h"
#include "mutt.h"
#include "pgp.h"
#include "address.h"
-#include "ascii.h"
#include "body.h"
#include "charset.h"
#include "crypt.h"
#include "smime.h"
#include "address.h"
#include "alias.h"
-#include "ascii.h"
#include "body.h"
#include "copy.h"
#include "crypt.h"
#include "config.h"
#include "parameter.h"
-#include "ascii.h"
void mutt_free_parameter(struct Parameter **p)
{
#include <string.h>
#include <time.h>
#include "mutt.h"
-#include "ascii.h"
#include "body.h"
#include "buffer.h"
#include "charset.h"
#include "mutt.h"
#include "pattern.h"
#include "address.h"
-#include "ascii.h"
#include "body.h"
#include "buffer.h"
#include "context.h"
account.c
addrbook.c
alias.c
-ascii.c
attach.c
base64.c
bcache.c
keymap.c
keymap_alldefs.h
lib.c
+lib/lib_ascii.c
main.c
mbox.c
mbyte.c
#include <stdio.h>
#include <string.h>
#include "account.h"
-#include "ascii.h"
#include "globals.h"
#include "lib.h"
#include "lib/lib.h"
#include <string.h>
#include "mutt.h"
#include "account.h"
-#include "ascii.h"
#include "context.h"
#include "globals.h"
#include "header.h"
#include <time.h>
#include <unistd.h>
#include "mutt.h"
-#include "ascii.h"
#include "body.h"
#include "context.h"
#include "envelope.h"
#include <sys/stat.h>
#include <unistd.h>
#include "mutt.h"
-#include "ascii.h"
#include "attach.h"
#include "body.h"
#include "context.h"
#include "mutt.h"
#include "remailer.h"
#include "address.h"
-#include "ascii.h"
#include "envelope.h"
#include "filter.h"
#include "format_flags.h"
#include <unistd.h>
#include "mutt.h"
#include "rfc1524.h"
-#include "ascii.h"
#include "body.h"
#include "globals.h"
#include "lib.h"
#include <string.h>
#include "rfc2047.h"
#include "address.h"
-#include "ascii.h"
#include "charset.h"
#include "globals.h"
#include "lib.h"
#include <string.h>
#include <unistd.h>
#include "mutt.h"
-#include "ascii.h"
#include "body.h"
#include "globals.h"
#include "header.h"
buf_off++;
/* test for signature separator */
- sigsep = (ascii_strcmp(buf + buf_off, "-- ") == 0);
+ sigsep = (mutt_strcmp(buf + buf_off, "-- ") == 0);
/* a fixed line either has no trailing space or is the
* signature separator */
while (fgets(buf, sizeof(buf), in))
{
- if ((ascii_strncmp("From ", buf, 5) == 0) || buf[0] == ' ')
+ if ((mutt_strncmp("From ", buf, 5) == 0) || buf[0] == ' ')
{
fputc(' ', out);
#ifdef DEBUG
#include <stdio.h>
#include <string.h>
#include "rfc822.h"
-#include "ascii.h"
#include "lib/lib.h"
#ifdef TESTING
{
if (!buflen)
goto done;
- if ((ascii_strcmp(addr->mailbox, "@") != 0) && !display)
+ if ((mutt_strcmp(addr->mailbox, "@") != 0) && !display)
{
strfcpy(pbuf, addr->mailbox, buflen);
len = mutt_strlen(pbuf);
}
- else if ((ascii_strcmp(addr->mailbox, "@") != 0) && display)
+ else if ((mutt_strcmp(addr->mailbox, "@") != 0) && display)
{
strfcpy(pbuf, mutt_addr_for_display(addr), buflen);
len = mutt_strlen(pbuf);
#include "mutt.h"
#include "address.h"
#include "alias.h"
-#include "ascii.h"
#include "body.h"
#include "context.h"
#include "copy.h"
#include <wchar.h>
#include "mutt.h"
#include "address.h"
-#include "ascii.h"
#include "body.h"
#include "buffy.h"
#include "charset.h"
if (b->next && check_boundary(boundary, b->next))
return true;
- if ((p = mutt_get_parameter("boundary", b->parameter)) && (ascii_strcmp(p, boundary) == 0))
+ if ((p = mutt_get_parameter("boundary", b->parameter)) && (mutt_strcmp(p, boundary) == 0))
return true;
return false;
}
#include "mutt.h"
#include "account.h"
#include "address.h"
-#include "ascii.h"
#include "globals.h"
#include "lib.h"
#include "lib/lib.h"
#include <string.h>
#include "mutt.h"
#include "url.h"
-#include "ascii.h"
#include "envelope.h"
#include "globals.h"
#include "lib.h"