X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib.c;h=39676a5a997e563f04542ea16bfe34bb925c5386;hb=06797b065bbd5d88bf473c4b9f8525dcb9990bb7;hp=33d377ffa3dbfac1a7369c96fc7112e7129c04a9;hpb=ae0ce4dfcafa0c3820f107c5bfa8bd06e5272b57;p=apps%2Fmadmutt.git diff --git a/lib.c b/lib.c index 33d377f..39676a5 100644 --- a/lib.c +++ b/lib.c @@ -28,76 +28,13 @@ #include #include -#ifdef HAVE_SYSEXITS_H -#include -#else /* Make sure EX_OK is defined */ -#define EX_OK 0 -#endif - #include #include #include +#include #include "lib.h" -#include "lib/debug.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; @@ -108,39 +45,3 @@ void mutt_nocurses_error (const char *fmt, ...) fputc ('\n', stderr); } - -/* these characters must be escaped in regular expressions */ - -static char rx_special_chars[] = "^.[$()|*+?{\\"; - -int mutt_rx_sanitize_string (char *dest, size_t destlen, const char *src) -{ - while (*src && --destlen > 2) { - if (strchr (rx_special_chars, *src)) { - *dest++ = '\\'; - destlen--; - } - *dest++ = *src++; - } - - *dest = '\0'; - - if (*src) - return -1; - else - return 0; -} - -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; -}