2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
4 * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
6 * This file is part of mutt-ng, see http://www.muttng.org/.
7 * It's licensed under the GNU General Public License,
8 * please see the file GPL in the top level source directory.
12 * This file used to contain some more functions, namely those
13 * which are now in muttlib.c. They have been removed, so we have
14 * some of our "standard" functions in external programs, too.
31 #ifdef HAVE_SYSEXITS_H
33 #else /* Make sure EX_OK is defined <philiph@pobox.com> */
37 #include <lib-lib/macros.h>
38 #include <lib-lib/mem.h>
39 #include <lib-lib/str.h>
43 #include "lib/debug.h"
45 static struct sysexits
53 { 0xff & EX_USAGE, "Bad usage." },
56 { 0xff & EX_DATAERR, "Data format error." },
59 { 0xff & EX_NOINPUT, "Cannot open input." },
62 { 0xff & EX_NOUSER, "User unknown." },
65 { 0xff & EX_NOHOST, "Host unknown." },
68 { 0xff & EX_UNAVAILABLE, "Service unavailable." },
71 { 0xff & EX_SOFTWARE, "Internal error." },
74 { 0xff & EX_OSERR, "Operating system error." },
77 { 0xff & EX_OSFILE, "System file missing." },
80 { 0xff & EX_CANTCREAT, "Can't create output." },
83 { 0xff & EX_IOERR, "I/O error." },
86 { 0xff & EX_TEMPFAIL, "Deferred." },
89 { 0xff & EX_PROTOCOL, "Remote protocol error." },
92 { 0xff & EX_NOPERM, "Insufficient permission." },
95 { 0xff & EX_NOPERM, "Local configuration error." },
97 { S_ERR, "Exec error." },
101 void mutt_nocurses_error (const char *fmt, ...)
106 vfprintf (stderr, fmt, ap);
108 fputc ('\n', stderr);
112 /* these characters must be escaped in regular expressions */
114 static char rx_special_chars[] = "^.[$()|*+?{\\";
116 int mutt_rx_sanitize_string (char *dest, size_t destlen, const char *src)
118 while (*src && --destlen > 2) {
119 if (strchr (rx_special_chars, *src)) {
135 mutt_strsysexit(int e)
139 for(i = 0; sysexits_h[i].str; i++)
141 if(e == sysexits_h[i].v)
145 return sysexits_h[i].str;