-#include "config.h"
-#include "internetmail.h"
-
-/* message delivery classes */
-enum {
- DELIVER_LOCAL,
- DELIVER_REMOTE,
- DELIVER_INTERNET,
- DELIVER_CCITADEL
-};
-
-
-#undef tolower
-#define tolower(x) isupper(x) ? (x+'a'-'A') : x
-
-char *monthdesc[] =
-{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
-
-char ALIASES[128];
-char CIT86NET[128];
-char SENDMAIL[128];
-char FALLBACK[128];
-char GW_DOMAIN[128];
-char TABLEFILE[128];
-char OUTGOING_FQDN[128];
-int RUN_NETPROC = 1;
-
-
-long conv_date(char *sdbuf)
-{
- int a, b, cpos, tend, tval;
- time_t now;
- struct tm *tmbuf;
- char dbuf[128];
-
- strcpy(dbuf, sdbuf);
- time(&now);
- tmbuf = (struct tm *) localtime(&now);
-
- /* get rid of + or - timezone mods */
- for (a = 0; a < strlen(dbuf); ++a)
- if ((dbuf[a] == '+') || (dbuf[a] == '-'))
- do {
- strcpy(&dbuf[a], &dbuf[a + 1]);
- } while ((dbuf[a] != 32) && (dbuf[a] != 0));
-
- /* try and extract the time by looking for colons */
- cpos = (-1);
- for (a = strlen(dbuf); a >= 0; --a)
- if ((dbuf[a] == ':') && (atoi(&dbuf[a - 1]) != 0))
- cpos = a;
- if (cpos >= 0) {
- cpos = cpos - 2;
- tend = strlen(dbuf);
- for (a = tend; a >= cpos; --a)
- if (dbuf[a] == ' ')
- tend = a;
-
- tmbuf->tm_hour = atoi(&dbuf[cpos]);
- tmbuf->tm_min = atoi(&dbuf[cpos + 3]);
- tmbuf->tm_sec = atoi(&dbuf[cpos + 6]);
-
- do {
- strcpy(&dbuf[cpos], &dbuf[cpos + 1]);
- } while ((dbuf[cpos] != 32) && (dbuf[cpos] != 0));
- }
- /* next try to extract a month */
-
- tval = (-1);
- for (a = 0; a < strlen(dbuf); ++a)
- for (b = 0; b < 12; ++b)
- if (!strncmp(&dbuf[a], monthdesc[b], 3)) {
- tval = b;
- cpos = a;
- }
- if (tval >= 0) {
- tmbuf->tm_mon = tval;
- strcpy(&dbuf[cpos], &dbuf[cpos + 3]);
- }
- /* now the year */
-
- for (a = 0; a < strlen(dbuf); ++a)
- if ((atoi(&dbuf[a]) >= 1900) && (dbuf[a] != 32)) {
- tmbuf->tm_year = atoi(&dbuf[a]) - 1900;
- strcpy(&dbuf[a], &dbuf[a + 4]);
- }
- /* whatever's left is the mday (hopefully) */
-
- for (a = 0; a < strlen(dbuf); ++a)
- if ((dbuf[a] != 32) && (atoi(&dbuf[a]) >= 1) && (atoi(&dbuf[a]) <= 31)
- && ((a == 0) || (dbuf[a - 1] == ' '))) {
- tmbuf->tm_mday = atoi(&dbuf[a]);
- strcpy(&dbuf[a], &dbuf[a + 2]);
- }
- return ((long) mktime(tmbuf));
-}
-
-
-#ifndef HAVE_STRERROR
-/*
- * replacement strerror() for systems that don't have it
- */
-char *strerror(int e)
-{
- static char buf[32];