if (!WIFEXITED(status) || WEXITSTATUS(status))
{
mutt_error(_("Tunnel to %s returned error %d (%s)"), conn->account.host,
- WEXITSTATUS(status), NONULL(mutt_strsysexit(WEXITSTATUS(status))));
+ WEXITSTATUS(status), NONULL(mutt_str_sysexit(WEXITSTATUS(status))));
mutt_sleep(2);
}
FREE(&conn->sockdata);
#define FMT_CENTER 0
#define FMT_RIGHT 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);
+const char *mutt_str_sysexit(int e);
char *mutt_compile_help(char *buf, size_t buflen, int menu, const struct Mapping *items);
* | mutt_str_strnfcpy() | Copy a limited string into a buffer (guaranteeing NUL-termination)
* | mutt_str_substr_cpy() | Copy a sub-string into a buffer
* | mutt_str_substr_dup() | Duplicate a sub-string
+ * | mutt_str_sysexit() | Return a string matching an error code
* | mutt_str_word_casecmp() | Find word a in word list b
*/
#include "debug.h"
#include "memory.h"
#include "string2.h"
+#ifdef HAVE_SYSEXITS_H
+#include <sysexits.h>
+#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 },
+};
+
+/**
+ * mutt_str_sysexit - Return a string matching an error code
+ * @param e Error code, e.g. EX_NOPERM
+ */
+const char *mutt_str_sysexit(int e)
+{
+ int i;
+
+ for (i = 0; sysexits_h[i].str; i++)
+ {
+ if (e == sysexits_h[i].v)
+ break;
+ }
+
+ return sysexits_h[i].str;
+}
/**
* mutt_str_atol - Convert ASCII string to a long
#define ISSPACE(c) isspace((unsigned char) c)
#define EMAIL_WSP " \t\r\n"
+/* Exit values */
+#define S_ERR 127
+#define S_BKG 126
+
/* this macro must check for (*c == 0) since isspace(0) has unreliable behavior
on some systems */
#define SKIPWS(c) \
char * mutt_str_strnfcpy(char *dest, char *src, size_t size, size_t dlen);
char * mutt_str_substr_cpy(char *dest, const char *begin, const char *end, size_t destlen);
char * mutt_str_substr_dup(const char *begin, const char *end);
+const char *mutt_str_sysexit(int e);
int mutt_str_word_casecmp(const char *a, const char *b);
#endif /* _MUTT_STRING_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;
#ifdef HAVE_SYSEXITS_H
#include <sysexits.h>
-#else /* Make sure EX_OK is defined <philiph@pobox.com> */
+#else
#define EX_OK 0
#endif
+
/* If you are debugging this file, comment out the following line. */
#define NDEBUG
#ifdef NDEBUG
{
const char *e = NULL;
- e = mutt_strsysexit(i);
+ e = mutt_str_sysexit(i);
mutt_error(_("Error sending message, child exited %d (%s)."), i, NONULL(e));
if (childout)
{