#include <lib-mime/mime.h>
+#include <lib-sys/exit.h>
+
#include <lib-ui/curses.h>
#include <lib-ui/enter.h>
#include <lib-ui/menu.h>
noinst_LIBRARIES = libsys.a
-libsys_a_SOURCES = mutt_socket.h mutt_tunnel.c mutt_ssl.h \
- mutt_socket.c mutt_tunnel.h mutt_ssl.c mutt_ssl_gnutls.c
+libsys_a_SOURCES = exit.h \
+ exit.c \
+ $(___networking_part____) \
+ mutt_socket.h mutt_tunnel.c mutt_ssl.h \
+ mutt_socket.c mutt_tunnel.h mutt_ssl.c mutt_ssl_gnutls.c
noinst_HEADERS = mutt_socket.h mutt_tunnel.c mutt_ssl.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
+ */
+/*
+ * Copyright notice from original mutt:
+ * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdlib.h>
+#ifdef HAVE_SYSEXITS_H
+#include <sysexits.h>
+#else /* Make sure EX_OK is defined <philiph@pobox.com> */
+#define EX_OK 0
+#endif
+
+#include <lib-lib/mem.h>
+
+#include "exit.h"
+
+static const struct {
+ 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." },
+};
+
+const char *m_strsysexit(int e)
+{
+ int i;
+
+ for (i = 0; countof(sysexits_h); i++) {
+ if (e == sysexits_h[i].v)
+ return sysexits_h[i].str;
+ }
+
+ return "";
+}
--- /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) 1996-2000 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
+ */
+
+#ifndef MUTT_LIB_SYS_EXIT_H
+#define MUTT_LIB_SYS_EXIT_H
+
+/* Exit values used in send_msg() */
+#define S_ERR 127
+#define S_BKG 126
+
+const char *m_strsysexit(int e);
+
+#endif /* MUTT_LIB_SYS_EXIT_H */
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
mutt_error(_("Tunnel to %s returned error %d (%s)"),
conn->account.host, WEXITSTATUS(status),
- NONULL(mutt_strsysexit(WEXITSTATUS(status))));
+ m_strsysexit(WEXITSTATUS(status)));
mutt_sleep (2);
}
p_delete(&conn->sockdata);
#include <fcntl.h>
#include <pwd.h>
-#ifdef HAVE_SYSEXITS_H
-#include <sysexits.h>
-#else /* Make sure EX_OK is defined <philiph@pobox.com> */
-#define EX_OK 0
-#endif
-
#include <lib-lib/macros.h>
#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include "lib.h"
-
-static 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;
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;
-}
void mutt_exit (int);
-/* Exit values used in send_msg() */
-#define S_ERR 127
-#define S_BKG 126
-
/* The actual library functions. */
void mutt_nocurses_error (const char *, ...);
-const char *mutt_strsysexit(int e);
-
#endif
#include <lib-lib/file.h>
#include <lib-lib/debug.h>
+#include <lib-sys/exit.h>
+
#include <lib-mime/mime.h>
#include <lib-ui/curses.h>
if ((i = send_msg (path, args, msg, &childout)) != (EX_OK & 0xff)) {
if (i != S_BKG) {
- const char *e = mutt_strsysexit (i);
-
- e = mutt_strsysexit (i);
mutt_error (_("Error sending message, child exited %d (%s)."), i,
- NONULL (e));
+ m_strsysexit(i));
if (childout) {
struct stat st;