curs_lib.c curs_main.c edit.c editmsg.c enter.c enter_state.h \
envelope.h filter.c flags.c format_flags.h from.c getdomain.c group.c \
handler.c hdrline.c header.h headers.c help.c history.c hook.c \
- init.c keymap.c lib.c list.h main.c mbox.c mbyte.c mbyte_table.h \
+ init.c keymap.c list.h main.c mbox.c mbyte.c mbyte_table.h \
menu.c mh.c muttlib.c mutt_idna.c mutt_sasl_plain.c mutt_socket.c \
mutt_tunnel.c mx.c newsrc.c nntp.c options.h pager.c parameter.c parameter.h \
parse.c pattern.c pattern.h pop.c pop_auth.c pop_lib.c postpone.c \
EXTRA_DIST = account.h attach.h bcache.h browser.h buffy.h \
ChangeLog.md charset.h CODE_OF_CONDUCT.md compress.h copy.h \
COPYRIGHT filter.h functions.h gen_defs globals.h \
- group.h history.h init.h keymap.h lib.h LICENSE.md mailbox.h \
+ group.h history.h init.h keymap.h LICENSE.md mailbox.h \
mapping.h mbyte.h mime.h mime.types mutt.h mutt_commands.h \
mutt_curses.h mutt_idna.h mutt_lua.h mutt_menu.h mutt_notmuch.h \
mutt_options.h mutt_regex.h mutt_sasl.h mutt_sasl_plain.h \
EXTRA_SCRIPTS =
-pgpring_SOURCES = lib.c pgppubring.c
+pgpring_SOURCES = pgppubring.c
pgpring_LDADD = $(LIBOBJS) $(NCRYPT_LIBS) $(INTLLIBS) $(LIBLIB)
pgpring_DEPENDENCIES = $(LIBOBJS) $(NCRYPT_DEPS) $(INTLDEPS) $(LIBLIBDEPS)
#include "mutt.h"
#include "account.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include "protos.h"
#include "globals.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mapping.h"
#include "mutt_curses.h"
#include "charset.h"
#include "envelope.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mutt_curses.h"
#include "filter.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "bcache.h"
#include "account.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "protos.h"
#include "url.h"
#include "globals.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mapping.h"
#include "context.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mutt.h"
#include "mutt.h"
#include "charset.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "protos.h"
#include "globals.h"
#include "header.h"
#include "keymap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mapping.h"
#include "mutt_curses.h"
#include "globals.h"
#include "header.h"
#include "keymap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mime.h"
#include <string.h>
#include <sys/stat.h>
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include "protos.h"
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "context.h"
#include "format_flags.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mutt_curses.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "enter_state.h"
#include "globals.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mbyte.h"
#include "mutt_curses.h"
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "mutt_idna.h"
#include "copy.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mx.h"
#include "history.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mbyte.h"
#include "mutt_curses.h"
#define _MUTT_ENTER_STATE_H
#include <stddef.h>
-#include "lib.h"
#include "lib/lib.h"
/**
#define _MUTT_ENVELOPE_H
#include <stdbool.h>
-#include "lib.h"
#include "lib/lib.h"
/**
#include "context.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include <string.h>
#include <time.h>
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "protos.h"
#include <sys/socket.h>
#include <time.h>
#include <unistd.h>
-#include "lib.h"
#include "lib/lib.h"
int getdnsdomainname(char *d, size_t len)
#define _MUTT_GLOBALS_H
#include <signal.h>
-#include "lib.h"
#include "lib/lib.h"
#include "where.h"
#include "mutt_regex.h"
#include "group.h"
#include "address.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "protos.h"
#include "globals.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mime.h"
#include <unistd.h>
#include "backend.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mx.h"
#include <gdbm.h>
#include "backend.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
static void *hcache_gdbm_open(const char *path)
#include "hcache.h"
#include "hcversion.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mbyte.h"
#include <limits.h>
#include <stdio.h>
#include "backend.h"
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include <stddef.h>
#include <lmdb.h>
#include "backend.h"
-#include "lib.h"
#include "lib/lib.h"
/** The maximum size of the database file (2GiB).
#include <depot.h>
#include <villa.h>
#include "backend.h"
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include <tcbdb.h>
#include <tcutil.h>
#include "backend.h"
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include "format_flags.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mbyte_table.h"
#include "mutt_curses.h"
#include <stddef.h>
#include <stdbool.h>
#include <time.h>
-#include "lib.h"
/**
* struct Header - The header/envelope of an email
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mutt_idna.h"
#include "globals.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mapping.h"
#include "mbyte.h"
#include "history.h"
#include "charset.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "protos.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include <string.h>
#include "auth.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "protos.h"
#include "account.h"
#include "auth.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_socket.h"
#include "options.h"
#include "account.h"
#include "auth.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_socket.h"
#include "options.h"
#include "account.h"
#include "auth.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_socket.h"
#include "options.h"
#include "protos.h"
+#include "mutt.h"
#ifdef HAVE_HEIMDAL
#include <gssapi/gssapi.h>
#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE
#include "account.h"
#include "auth.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_socket.h"
#include "options.h"
#include "protos.h"
+#include "mutt.h"
/**
* imap_auth_login - Plain LOGIN support
#include "account.h"
#include "auth.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_sasl_plain.h"
#include "mutt_socket.h"
#include "account.h"
#include "auth.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_sasl.h"
#include "mutt_socket.h"
#include "context.h"
#include "globals.h"
#include "imap/imap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_regex.h"
#include "options.h"
#include "globals.h"
#include "header.h"
#include "imap/imap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "message.h"
#include "globals.h"
#include "header.h"
#include "imap/imap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "globals.h"
#include "header.h"
#include "imap/imap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "imap_private.h"
#include "charset.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
// clang-format off
#include "globals.h"
#include "header.h"
#include "imap/imap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "header.h"
#include "history.h"
#include "keymap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "functions.h"
#include "globals.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mapping.h"
#include "mutt.h"
+++ /dev/null
-/**
- * @file
- * Some very miscellaneous functions
- *
- * @authors
- * Copyright (C) 1996-2000,2007,2010 Michael R. Elkins <me@mutt.org>
- * Copyright (C) 1999-2004,2006-2007 Thomas Roessler <roessler@does-not-exist.org>
- *
- * @copyright
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file used to contain some more functions, namely those
- * which are now in muttlib.c. They have been removed, so we have
- * some of our "standard" functions in external programs, too.
- */
-
-#include "config.h"
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-#include "lib.h"
-#include "lib/lib.h"
-
-#ifdef HAVE_SYSEXITS_H
-#include <sysexits.h>
-#else /* Make sure EX_OK is defined <philiph@pobox.com> */
-#define EX_OK 0
-#endif
-
-/**
- * struct SysExits - Lookup table of error messages
- */
-static const struct SysExits
-{
- int v;
- const char *str;
-} sysexits_h[] = {
-#ifdef EX_USAGE
- { 0xff & EX_USAGE, "Bad usage." },
-#endif
-#ifdef EX_DATAERR
- { 0xff & EX_DATAERR, "Data format error." },
-#endif
-#ifdef EX_NOINPUT
- { 0xff & EX_NOINPUT, "Cannot open input." },
-#endif
-#ifdef EX_NOUSER
- { 0xff & EX_NOUSER, "User unknown." },
-#endif
-#ifdef EX_NOHOST
- { 0xff & EX_NOHOST, "Host unknown." },
-#endif
-#ifdef EX_UNAVAILABLE
- { 0xff & EX_UNAVAILABLE, "Service unavailable." },
-#endif
-#ifdef EX_SOFTWARE
- { 0xff & EX_SOFTWARE, "Internal error." },
-#endif
-#ifdef EX_OSERR
- { 0xff & EX_OSERR, "Operating system error." },
-#endif
-#ifdef EX_OSFILE
- { 0xff & EX_OSFILE, "System file missing." },
-#endif
-#ifdef EX_CANTCREAT
- { 0xff & EX_CANTCREAT, "Can't create output." },
-#endif
-#ifdef EX_IOERR
- { 0xff & EX_IOERR, "I/O error." },
-#endif
-#ifdef EX_TEMPFAIL
- { 0xff & EX_TEMPFAIL, "Deferred." },
-#endif
-#ifdef EX_PROTOCOL
- { 0xff & EX_PROTOCOL, "Remote protocol error." },
-#endif
-#ifdef EX_NOPERM
- { 0xff & EX_NOPERM, "Insufficient permission." },
-#endif
-#ifdef EX_CONFIG
- { 0xff & EX_NOPERM, "Local configuration error." },
-#endif
- { S_ERR, "Exec error." },
- { -1, NULL },
-};
-
-void mutt_nocurses_error(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- fputc('\n', stderr);
-}
-
-const char *mutt_strsysexit(int e)
-{
- int i;
-
- for (i = 0; sysexits_h[i].str; i++)
- {
- if (e == sysexits_h[i].v)
- break;
- }
-
- return sysexits_h[i].str;
-}
-
-#ifdef DEBUG
-char debugfilename[_POSIX_PATH_MAX];
-FILE *debugfile = NULL;
-int debuglevel;
-char *debugfile_cmdline = NULL;
-int debuglevel_cmdline;
-
-void mutt_debug(int level, const char *fmt, ...)
-{
- va_list ap;
- time_t now = time(NULL);
- static char buf[23] = "";
- static time_t last = 0;
-
- if (debuglevel < level || !debugfile)
- return;
-
- if (now > last)
- {
- strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", localtime(&now));
- last = now;
- }
- fprintf(debugfile, "[%s] ", buf);
- va_start(ap, fmt);
- vfprintf(debugfile, fmt, ap);
- va_end(ap);
-}
-#endif
-
-/**
- * mutt_inbox_cmp - do two folders share the same path and one is an inbox
- * @param a First path
- * @param b Second path
- * @retval -1 if a is INBOX of b
- * @retval 0 if none is INBOX
- * @retval 1 if b is INBOX for a
- *
- * This function compares two folder paths. It first looks for the position of
- * the last common '/' character. If a valid position is found and it's not the
- * last character in any of the two paths, the remaining parts of the paths are
- * compared (case insensitively) with the string "INBOX". If one of the two
- * paths matches, it's reported as being less than the other and the function
- * returns -1 (a < b) or 1 (a > b). If no paths match the requirements, the two
- * paths are considered equivalent and this function returns 0.
- *
- * Examples:
- * * mutt_inbox_cmp("/foo/bar", "/foo/baz") --> 0
- * * mutt_inbox_cmp("/foo/bar/", "/foo/bar/inbox") --> 0
- * * mutt_inbox_cmp("/foo/bar/sent", "/foo/bar/inbox") --> 1
- * * mutt_inbox_cmp("=INBOX", "=Drafts") --> -1
- */
-int mutt_inbox_cmp(const char *a, const char *b)
-{
- /* fast-track in case the paths have been mutt_pretty_mailbox'ified */
- if (a[0] == '=' && b[0] == '=')
- return (mutt_strcasecmp(a + 1, "inbox") == 0) ?
- -1 :
- (mutt_strcasecmp(b + 1, "inbox") == 0) ? 1 : 0;
-
- const char *a_end = strrchr(a, '/');
- const char *b_end = strrchr(b, '/');
-
- /* If one path contains a '/', but not the other */
- if (!a_end ^ !b_end)
- return 0;
-
- /* If neither path contains a '/' */
- if (!a_end)
- return 0;
-
- /* Compare the subpaths */
- size_t a_len = a_end - a;
- size_t b_len = b_end - b;
- size_t min = MIN(a_len, b_len);
- int same = (a[min] == '/') && (b[min] == '/') && (a[min + 1] != '\0') &&
- (b[min + 1] != '\0') && (mutt_strncasecmp(a, b, min) == 0);
-
- if (!same)
- return 0;
-
- if (mutt_strcasecmp(&a[min + 1], "inbox") == 0)
- return -1;
-
- if (mutt_strcasecmp(&b[min + 1], "inbox") == 0)
- return 1;
-
- return 0;
-}
-
+++ /dev/null
-/**
- * @file
- * Some very miscellaneous functions
- *
- * @authors
- * Copyright (C) 1996-2000,2007,2010,2012 Michael R. Elkins <me@mutt.org>
- * Copyright (C) 1999-2005,2007 Thomas Roessler <roessler@does-not-exist.org>
- *
- * @copyright
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-/* mutt functions which are generally useful. */
-
-#ifndef _MUTT_LIB_H
-#define _MUTT_LIB_H
-
-#include <ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-
-/* Use this with care. If the compiler can't see the array
- * definition, it obviously won't produce a correct result. */
-#define mutt_array_size(x) (sizeof(x) / sizeof((x)[0]))
-
-/* For mutt_simple_format() justifications */
-/* Making left 0 and center -1 is of course completely nonsensical, but
- * it retains compatibility for any patches that call mutt_simple_format.
- * Once patches are updated to use FMT_*, these can be made sane. */
-#define FMT_LEFT 0
-#define FMT_RIGHT 1
-#define FMT_CENTER -1
-
-#ifdef DEBUG
-extern char debugfilename[_POSIX_PATH_MAX];
-extern FILE *debugfile;
-extern int debuglevel;
-extern char *debugfile_cmdline;
-extern int debuglevel_cmdline;
-#endif
-
-/* Exit values used in send_msg() */
-#define S_ERR 127
-#define S_BKG 126
-
-int safe_asprintf(char **, const char *, ...);
-
-void mutt_nocurses_error(const char *, ...);
-int mutt_inbox_cmp(const char *a, const char *b);
-
-const char *mutt_strsysexit(int e);
-
-#endif /* _MUTT_LIB_H */
#ifndef _MUTT_LIST_H
#define _MUTT_LIST_H
-#include "lib.h"
/**
* struct List - Singly-linked List type
#include "globals.h"
#include "header.h"
#include "keymap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include <wchar.h>
#include "mbyte.h"
#include "charset.h"
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include "protos.h"
#include "globals.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mbyte.h"
#include "mutt_curses.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mutt_curses.h"
#define EXECSHELL "/bin/sh"
+/* Use this with care. If the compiler can't see the array
+ * definition, it obviously won't produce a correct result. */
+#define mutt_array_size(x) (sizeof(x) / sizeof((x)[0]))
+
+/* For mutt_simple_format() justifications */
+/* Making left 0 and center -1 is of course completely nonsensical, but
+ * it retains compatibility for any patches that call mutt_simple_format.
+ * Once patches are updated to use FMT_*, these can be made sane. */
+#define FMT_LEFT 0
+#define FMT_RIGHT 1
+#define FMT_CENTER -1
+
+/* Exit values used in send_msg() */
+#define S_ERR 127
+#define S_BKG 126
+
+int safe_asprintf(char **, const char *, ...);
+
+int mutt_inbox_cmp(const char *a, const char *b);
+
+const char *mutt_strsysexit(int e);
+
+#ifdef DEBUG
+extern char debugfilename[_POSIX_PATH_MAX];
+extern FILE *debugfile;
+extern int debuglevel;
+extern char *debugfile_cmdline;
+extern int debuglevel_cmdline;
+#endif
+
#endif /* _MUTT_H */
#define _MUTT_CURSES_H
#include <regex.h>
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include "charset.h"
#include "envelope.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include "mutt.h"
#include "mutt_lua.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mbyte_table.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mutt_curses.h"
#include <sys/socket.h>
#include "mutt_sasl.h"
#include "account.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_socket.h"
#include "options.h"
#include "config.h"
#include <stdio.h>
#include "mutt_sasl_plain.h"
-#include "lib.h"
#include "lib/lib.h"
#include "protos.h"
#include <stddef.h>
#include "account.h"
-#include "lib.h"
#include "lib/lib.h"
/* logging levels */
#include "globals.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_idna.h"
#include "mutt_menu.h"
#include "globals.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_menu.h"
#include "mutt_regex.h"
#include "mutt_tunnel.h"
#include "account.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_socket.h"
#include "protos.h"
#include "format_flags.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
}
}
}
+
+#ifdef HAVE_SYSEXITS_H
+#include <sysexits.h>
+#else /* Make sure EX_OK is defined <philiph@pobox.com> */
+#define EX_OK 0
+#endif
+
+/**
+ * struct SysExits - Lookup table of error messages
+ */
+static const struct SysExits
+{
+ int v;
+ const char *str;
+} sysexits_h[] = {
+#ifdef EX_USAGE
+ { 0xff & EX_USAGE, "Bad usage." },
+#endif
+#ifdef EX_DATAERR
+ { 0xff & EX_DATAERR, "Data format error." },
+#endif
+#ifdef EX_NOINPUT
+ { 0xff & EX_NOINPUT, "Cannot open input." },
+#endif
+#ifdef EX_NOUSER
+ { 0xff & EX_NOUSER, "User unknown." },
+#endif
+#ifdef EX_NOHOST
+ { 0xff & EX_NOHOST, "Host unknown." },
+#endif
+#ifdef EX_UNAVAILABLE
+ { 0xff & EX_UNAVAILABLE, "Service unavailable." },
+#endif
+#ifdef EX_SOFTWARE
+ { 0xff & EX_SOFTWARE, "Internal error." },
+#endif
+#ifdef EX_OSERR
+ { 0xff & EX_OSERR, "Operating system error." },
+#endif
+#ifdef EX_OSFILE
+ { 0xff & EX_OSFILE, "System file missing." },
+#endif
+#ifdef EX_CANTCREAT
+ { 0xff & EX_CANTCREAT, "Can't create output." },
+#endif
+#ifdef EX_IOERR
+ { 0xff & EX_IOERR, "I/O error." },
+#endif
+#ifdef EX_TEMPFAIL
+ { 0xff & EX_TEMPFAIL, "Deferred." },
+#endif
+#ifdef EX_PROTOCOL
+ { 0xff & EX_PROTOCOL, "Remote protocol error." },
+#endif
+#ifdef EX_NOPERM
+ { 0xff & EX_NOPERM, "Insufficient permission." },
+#endif
+#ifdef EX_CONFIG
+ { 0xff & EX_NOPERM, "Local configuration error." },
+#endif
+ { S_ERR, "Exec error." },
+ { -1, NULL },
+};
+
+const char *mutt_strsysexit(int e)
+{
+ int i;
+
+ for (i = 0; sysexits_h[i].str; i++)
+ {
+ if (e == sysexits_h[i].v)
+ break;
+ }
+
+ return sysexits_h[i].str;
+}
+
+#ifdef DEBUG
+char debugfilename[_POSIX_PATH_MAX];
+FILE *debugfile = NULL;
+int debuglevel;
+char *debugfile_cmdline = NULL;
+int debuglevel_cmdline;
+
+void mutt_debug(int level, const char *fmt, ...)
+{
+ va_list ap;
+ time_t now = time(NULL);
+ static char buf[23] = "";
+ static time_t last = 0;
+
+ if (debuglevel < level || !debugfile)
+ return;
+
+ if (now > last)
+ {
+ strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", localtime(&now));
+ last = now;
+ }
+ fprintf(debugfile, "[%s] ", buf);
+ va_start(ap, fmt);
+ vfprintf(debugfile, fmt, ap);
+ va_end(ap);
+}
+#endif
+
+/**
+ * mutt_inbox_cmp - do two folders share the same path and one is an inbox
+ * @param a First path
+ * @param b Second path
+ * @retval -1 if a is INBOX of b
+ * @retval 0 if none is INBOX
+ * @retval 1 if b is INBOX for a
+ *
+ * This function compares two folder paths. It first looks for the position of
+ * the last common '/' character. If a valid position is found and it's not the
+ * last character in any of the two paths, the remaining parts of the paths are
+ * compared (case insensitively) with the string "INBOX". If one of the two
+ * paths matches, it's reported as being less than the other and the function
+ * returns -1 (a < b) or 1 (a > b). If no paths match the requirements, the two
+ * paths are considered equivalent and this function returns 0.
+ *
+ * Examples:
+ * * mutt_inbox_cmp("/foo/bar", "/foo/baz") --> 0
+ * * mutt_inbox_cmp("/foo/bar/", "/foo/bar/inbox") --> 0
+ * * mutt_inbox_cmp("/foo/bar/sent", "/foo/bar/inbox") --> 1
+ * * mutt_inbox_cmp("=INBOX", "=Drafts") --> -1
+ */
+int mutt_inbox_cmp(const char *a, const char *b)
+{
+ /* fast-track in case the paths have been mutt_pretty_mailbox'ified */
+ if (a[0] == '=' && b[0] == '=')
+ return (mutt_strcasecmp(a + 1, "inbox") == 0) ?
+ -1 :
+ (mutt_strcasecmp(b + 1, "inbox") == 0) ? 1 : 0;
+
+ const char *a_end = strrchr(a, '/');
+ const char *b_end = strrchr(b, '/');
+
+ /* If one path contains a '/', but not the other */
+ if (!a_end ^ !b_end)
+ return 0;
+
+ /* If neither path contains a '/' */
+ if (!a_end)
+ return 0;
+
+ /* Compare the subpaths */
+ size_t a_len = a_end - a;
+ size_t b_len = b_end - b;
+ size_t min = MIN(a_len, b_len);
+ int same = (a[min] == '/') && (b[min] == '/') && (a[min + 1] != '\0') &&
+ (b[min + 1] != '\0') && (mutt_strncasecmp(a, b, min) == 0);
+
+ if (!same)
+ return 0;
+
+ if (mutt_strcasecmp(&a[min + 1], "inbox") == 0)
+ return -1;
+
+ if (mutt_strcasecmp(&b[min + 1], "inbox") == 0)
+ return 1;
+
+ return 0;
+}
+
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "ncrypt/ncrypt.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mime.h"
#include "mutt_curses.h"
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mime.h"
#include "config.h"
#include "crypt_mod.h"
-#include "lib.h"
#include "lib/lib.h"
/**
#include <stdio.h>
#include "crypt_mod.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "ncrypt.h"
#include "options.h"
#include "charset.h"
#include "filter.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mime.h"
#include "ncrypt.h"
#include "filter.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mime.h"
#include "filter.h"
#include "format_flags.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mutt_curses.h"
#include "gnupgparse.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mime.h"
#include "mutt_curses.h"
#include "config.h"
#include <stdbool.h>
#include "pgplib.h"
-#include "lib.h"
#include "lib/lib.h"
const char *pgp_pkalgbytype(unsigned char type)
#include <stdbool.h>
#include <time.h>
-#include "lib.h"
#include "lib/lib.h"
/**
#include <string.h>
#include <unistd.h>
#include "mutt.h"
-#include "lib.h"
#include "lib/lib.h"
#include "pgppacket.h"
#include "protos.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
-#include "lib.h"
#include "lib/lib.h"
#define CHUNKSIZE 1024
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mime.h"
#include "mutt_curses.h"
#include "format_flags.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "mutt_socket.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mutt_curses.h"
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mapping.h"
#ifndef _MUTT_PARAMETER_H
#define _MUTT_PARAMETER_H
-#include "lib.h"
#include "lib/lib.h"
/**
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "group.h"
#include "header.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include <regex.h>
#include <stdbool.h>
#include <stddef.h>
-#include "lib.h"
#include "lib/lib.h"
struct Address;
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include "lib.h"
#include "lib/lib.h"
#include "ncrypt/ncrypt.h"
#include "ncrypt/pgplib.h"
init.c
keymap.c
keymap_alldefs.h
-lib.c
lib/lib_ascii.c
lib/lib_base64.c
lib/lib_buffer.c
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mutt_curses.h"
#include <string.h>
#include "account.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_socket.h"
#include "options.h"
#include "context.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "mutt_socket.h"
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mapping.h"
#include "mutt_curses.h"
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mailbox.h"
#include "mapping.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "mutt_idna.h"
#include "header.h"
#include "keymap.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mapping.h"
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#ifdef HAVE_SYS_IOCTL_H
#include "rfc1524.h"
#include "body.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "options.h"
#include "parameter.h"
#include "address.h"
#include "charset.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mbyte.h"
#include "mime.h"
#include "rfc2231.h"
#include "charset.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mbyte.h"
#include "mime.h"
#include "body.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "options.h"
#include <stddef.h>
#include <stdbool.h>
#include "address.h"
-#include "lib.h"
#include "lib/lib.h"
/**
#include <stdarg.h>
#include <stdio.h>
-#include "lib.h"
#include "lib/lib.h"
/* NOTE: Currently there is no check in configure.ac for vasprintf(3). the
#include "globals.h"
#include "header.h"
#include "keymap.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_menu.h"
#include "options.h"
#include "filter.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "format_flags.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "mailbox.h"
#include "format_flags.h"
#include "globals.h"
#include "keymap_defs.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include <stdlib.h>
#include <string.h>
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "options.h"
#include "account.h"
#include "address.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_curses.h"
#include "mutt_socket.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mutt_idna.h"
#include "options.h"
#include "config.h"
#include <stdarg.h>
#include "state.h"
-#include "lib.h"
#include "globals.h"
#include "mbyte.h"
#include "context.h"
#include "format_flags.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mapping.h"
#include "mbyte_table.h"
#include "envelope.h"
#include "globals.h"
#include "header.h"
-#include "lib.h"
#include "lib/lib.h"
#include "list.h"
#include "options.h"
#include "url.h"
#include "envelope.h"
#include "globals.h"
-#include "lib.h"
#include "lib/lib.h"
#include "mapping.h"
#include "mime.h"
#include <string.h>
#include <sys/utsname.h>
#include <unistd.h>
-#include "lib.h"
#include "lib/lib.h"
#ifdef HAVE_STRINGPREP_H
#include <stringprep.h>