if (nl && buf[0] != ' ' && buf[0] != '\t') {
/* set curline to 1 for To:/Cc:/Bcc: and 0 otherwise */
- curline = (flags & CH_WEED) && (ascii_strncmp ("To:", buf, 3) == 0 ||
- ascii_strncmp ("Cc:", buf, 3) == 0 ||
- ascii_strncmp ("Bcc:", buf, 4) == 0);
+ curline = (flags & CH_WEED) && (m_strncmp("To:", buf, 3) == 0 ||
+ m_strncmp("Cc:", buf, 3) == 0 ||
+ m_strncmp("Bcc:", buf, 4) == 0);
/* Do we have anything pending? */
if (this_one) {
if (mutt_bit_isset (idata->capabilities, AUTH_ANON) &&
(!idata->conn->account.user[0] ||
- !ascii_strncmp (idata->conn->account.user, "anonymous", 9)))
+ !m_strncmp(idata->conn->account.user, "anonymous", 9)))
rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen,
&mech);
}
mbox[n] = '\0';
}
}
- }
- while (ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN));
+ } while (m_strncmp(idata->cmd.buf, idata->cmd.seq, SEQLEN));
}
/* if we're descending a folder, mark it as current in browser_state */
imap_add_folder (idata->delim, name, noselect, noinferiors, state,
isparent);
}
- }
- while ((ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
+ } while ((m_strncmp(idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
p_delete(&mx.mbox);
return 0;
&nsi->noinferiors, &delim) != 0)
return -1;
nsi->listable |= (name != NULL);
- }
- while ((ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
+ } while ((m_strncmp(idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
}
return 0;
idata->lastread = time (NULL);
/* handle untagged messages. The caller still gets its shot afterwards. */
- if (!ascii_strncmp (cmd->buf, "* ", 2) && cmd_handle_untagged (idata))
+ if (!m_strncmp(cmd->buf, "* ", 2) && cmd_handle_untagged (idata))
return IMAP_CMD_BAD;
/* server demands a continuation response from us */
return IMAP_CMD_RESPOND;
/* tagged completion code */
- if (!ascii_strncmp (cmd->buf, cmd->seq, SEQLEN)) {
+ if (!m_strncmp(cmd->buf, cmd->seq, SEQLEN)) {
imap_cmd_finish (idata);
return imap_code (cmd->buf) ? IMAP_CMD_OK : IMAP_CMD_NO;
}
imap_fix_path (idata, mx.mbox, mailbox, sizeof (mailbox));
/* we may already be in the folder we're checking */
- if (!ascii_strcmp(idata->mailbox, mx.mbox)) {
+ if (!m_strcmp(idata->mailbox, mx.mbox)) {
p_delete(&mx.mbox);
return 0;
}
completions++;
}
}
- while (ascii_strncmp (idata->cmd.seq, idata->cmd.buf, SEQLEN));
+ while (m_strncmp(idata->cmd.seq, idata->cmd.buf, SEQLEN));
if (completions) {
/* reformat output */
int clean = 0;
/* get some $madmutt_ values dynamically */
- if (ascii_strcmp ("madmutt_pwd", option->option) == 0) {
+ if (m_strcmp("madmutt_pwd", option->option) == 0) {
val = p_new(char, _POSIX_PATH_MAX);
val = getcwd (val, _POSIX_PATH_MAX-1);
clean = 1;
- } else if (ascii_strcmp ("madmutt_folder_path", option->option) == 0 &&
+ } else if (m_strcmp("madmutt_folder_path", option->option) == 0 &&
CurrentFolder && *CurrentFolder) {
val = CurrentFolder;
- } else if (ascii_strcmp ("madmutt_folder_name", option->option) == 0 &&
+ } else if (m_strcmp("madmutt_folder_name", option->option) == 0 &&
CurrentFolder && *CurrentFolder) {
ssize_t Maildirlength = m_strlen(Maildir);
}
/* see if we need to add $user_ var */
- if (!option && ascii_strncmp ("user_", tmp->data, 5) == 0) {
+ if (!option && m_strncmp("user_", tmp->data, 5) == 0) {
/* there's no option named like this yet so only add one
* if the action isn't any of: reset, unset, query */
if (!(reset || unset || query || *s->dptr != '=')) {
noinst_LIBRARIES = liblib.a
-liblib_a_SOURCES = lib-lib.h mem.h macros.h \
- str.h ascii.h buffer.h hash.h list.h file.h mapping.h \
- str.c ascii.c buffer.c hash.c list.c file.c mapping.c \
- \
- date.h rx.h url.h \
- date.c rx.c url.c
+liblib_a_SOURCES = lib-lib.h mem.h \
+ str.h buffer.h hash.h list.h file.h mapping.h date.h rx.h url.h \
+ str.c buffer.c hash.c list.c file.c mapping.c date.c rx.c url.c
-noinst_HEADERS = lib-lib.h mem.h macros.h \
- str.h ascii.h buffer.h hash.h list.h file.h mapping.h \
- date.h rx.h url.h
+noinst_HEADERS = lib-lib.h mem.h \
+ str.h buffer.h hash.h list.h file.h mapping.h date.h rx.h url.h
-include ../cflags.mk
+++ /dev/null
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Copyright © 2006 Pierre Habouzit
- */
-/*
- * Copyright notice from original mutt:
- * Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org>
- */
-
-/*
- * Versions of the string comparison functions which are locale-insensitive.
- */
-
-#include "lib-lib.h"
-
-int ascii_strcasecmp(const char *a, const char *b)
-{
- int i;
-
- if (a == b)
- return 0;
- if (a == NULL && b)
- return -1;
- if (b == NULL && a)
- return 1;
-
- for (; *a || *b; a++, b++) {
- if ((i = ascii_tolower(*a) - ascii_tolower(*b)))
- return i;
- }
-
- return 0;
-}
-
-int ascii_strncasecmp (const char *a, const char *b, int n)
-{
- int i, j;
-
- if (a == b)
- return 0;
- if (a == NULL && b)
- return -1;
- if (b == NULL && a)
- return 1;
-
- for (j = 0; (*a || *b) && j < n; a++, b++, j++) {
- if ((i = ascii_tolower(*a) - ascii_tolower(*b)))
- return i;
- }
-
- return 0;
-}
+++ /dev/null
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Copyright © 2006 Pierre Habouzit
- */
-/*
- * Copyright notice from original mutt:
- * Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org>
- */
-
-#ifndef MUTT_LIB_LIB_ASCII_H
-#define MUTT_LIB_LIB_ASCII_H
-
-static inline int ascii_isupper(int c) {
- return c >= 'A' && c <= 'Z';
-}
-
-static inline int ascii_islower(int c) {
- return c >= 'a' && c <= 'z';
-}
-
-static inline int ascii_toupper(int c) {
- if (ascii_islower(c))
- return c & ~32;
-
- return c;
-}
-
-static inline int ascii_tolower(int c) {
- if (ascii_isupper(c))
- return c | 32;
-
- return c;
-}
-
-int ascii_strcasecmp(const char *a, const char *b);
-int ascii_strncasecmp(const char *a, const char *b, int n);
-
-#define ascii_strcmp(a,b) m_strcmp(a,b)
-#define ascii_strncmp(a,b,c) m_strncmp(a,b,c)
-
-#endif /* MUTT_LIB_LIB_ASCII_H */
# include "../config.h"
#endif
+#ifndef __GNUC__
+# define __attribute__(a)
+#endif
+
+/* very common and usual headers we just want to have available {{{ */
+
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <posix1_lim.h>
#endif
+/* }}} */
+/* useful and common macros {{{ */
+
+#ifdef _
+# undef _
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+#define _(a) (gettext(a))
+# ifdef gettext_noop
+# define N_(a) gettext_noop(a)
+# else
+# define N_(a) (a)
+# endif
+#else
+# define _(a) (a)
+# define N_(a) (a)
+#endif
+
+#define TRUE 1
+#define FALSE 0
+
+#undef MAX
+#undef MIN
+#define MAX(a,b) ((a) < (b) ? (b) : (a))
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+/* }}} */
-#include "macros.h"
#include "mem.h"
-#include "ascii.h"
#include "str.h"
#include "buffer.h"
#include "date.h"
+++ /dev/null
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Copyright © 2006 Pierre Habouzit
- */
-
-#ifndef MUTT_LIB_LIB_MACROS_H
-#define MUTT_LIB_LIB_MACROS_H
-
-#ifndef __GNUC__
-# define __attribute__(a)
-#endif
-
-/*
- * config.h must be included by source file!
- */
-
-#ifdef _
-# undef _
-#endif
-
-#ifdef ENABLE_NLS
-# include <libintl.h>
-#define _(a) (gettext(a))
-# ifdef gettext_noop
-# define N_(a) gettext_noop(a)
-# else
-# define N_(a) (a)
-# endif
-#else
-# define _(a) (a)
-# define N_(a) (a)
-#endif
-
-
-#define TRUE 1
-#define FALSE 0
-
-#undef MAX
-#undef MIN
-#define MAX(a,b) ((a) < (b) ? (b) : (a))
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
-#endif /* MUTT_LIB_LIB_MACROS_H */
haystack++;
}
}
+
+int ascii_strcasecmp(const char *a, const char *b)
+{
+ int i;
+
+ if (a == b)
+ return 0;
+ if (a == NULL && b)
+ return -1;
+ if (b == NULL && a)
+ return 1;
+
+ for (; *a || *b; a++, b++) {
+ if ((i = ascii_tolower(*a) - ascii_tolower(*b)))
+ return i;
+ }
+
+ return 0;
+}
+
+int ascii_strncasecmp (const char *a, const char *b, ssize_t n)
+{
+ int i, j;
+
+ if (a == b)
+ return 0;
+ if (a == NULL && b)
+ return -1;
+ if (b == NULL && a)
+ return 1;
+
+ for (j = 0; (*a || *b) && j < n; a++, b++, j++) {
+ if ((i = ascii_tolower(*a) - ascii_tolower(*b)))
+ return i;
+ }
+
+ return 0;
+}
*
* Copyright © 2006 Pierre Habouzit
*/
+/*
+ * Copyright notice from original mutt:
+ * Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org>
+ */
#ifndef MUTT_LIB_LIB_STR_H
#define MUTT_LIB_LIB_STR_H
*p = tolower((unsigned char)*p);
}
+static inline int ascii_toupper(int c) {
+ if ('a' <= c && c <= 'z')
+ return c & ~32;
+
+ return c;
+}
+
+static inline int ascii_tolower(int c) {
+ if ('A' <= c && c <= 'Z')
+ return c | 32;
+
+ return c;
+}
+
/****************************************************************************/
/* length related */
/****************************************************************************/
return strncasecmp(NONULL(a), NONULL(b), n);
}
+int ascii_strcasecmp(const char *a, const char *b);
+int ascii_strncasecmp(const char *a, const char *b, ssize_t n);
+
/****************************************************************************/
/* making copies */
/****************************************************************************/
}
while (fgets (buf, sizeof (buf), in)) {
- if (ascii_strncmp ("From ", buf, 4) == 0 || buf[0] == ' ') {
+ if (m_strncmp("From ", buf, 4) == 0 || buf[0] == ' ') {
fputc (' ', out);
}
fputs (buf, out);