Removed mts.conf; the maildelivery option went into slocal directly.
[mmh] / sbr / mts.c
index 503ec3c..6b8b3a2 100644 (file)
--- a/sbr/mts.c
+++ b/sbr/mts.c
 /*
 ** static prototypes
 */
-static char *tailor_value(unsigned char *);
 static void getuserinfo(void);
-static const char *get_mtsconf_pathname(void);
-static const char *get_mtsuserconf_pathname(void);
-static void mts_read_conf_file(FILE *fp);
-
-/*
-** nmh mail transport interface customization file
-*/
-static char *mtsconf = NMHETCDIR"/mts.conf";
-
 
 /* Cache the username and fullname of the user */
 static char username[BUFSIZ];
 static char fullname[BUFSIZ];
 
-/*
-** Global MailDelivery file
-*/
-char *maildelivery = NMHETCDIR"/maildelivery";
-
-/*
-** Customize the MTS settings for nmh by adjusting
-** the file mts.conf in the nmh etc directory.
-*/
-
-struct bind {
-       char *keyword;
-       char **value;
-};
-
-static struct bind binds[] = {
-       { "maildelivery", &maildelivery },
-       { NULL, NULL }
-};
-
-
-/*
-** Read the configuration file for the nmh interface
-** to the mail transport system (MTS).
-*/
-
-void
-mts_init(char *name)
-{
-       const char *cp;
-       FILE *fp;
-       static int inited = 0;
-
-       if (inited++ || (fp = fopen(get_mtsconf_pathname(), "r")) == NULL)
-               return;
-       mts_read_conf_file(fp);
-       fclose(fp);
-
-       cp = get_mtsuserconf_pathname();
-       if (cp != NULL &&
-               ((fp = fopen(get_mtsuserconf_pathname(), "r")) != NULL)) {
-               mts_read_conf_file(fp);
-               fclose(fp);
-       }
-}
-
-
-#define QUOTE  '\\'
-
-/*
-** Convert escaped values, malloc some new space,
-** and copy string to malloc'ed memory.
-*/
-
-static char *
-tailor_value(unsigned char *s)
-{
-       int i, r;
-       char *bp;
-       char buffer[BUFSIZ];
-       size_t len;
-
-       for (bp = buffer; *s; bp++, s++) {
-               if (*s != QUOTE) {
-                       *bp = *s;
-               } else {
-                       switch (*++s) {
-                       case 'b': *bp = '\b'; break;
-                       case 'f': *bp = '\f'; break;
-                       case 'n': *bp = '\n'; break;
-                       case 't': *bp = '\t'; break;
-
-                       case 0: s--;
-                       case QUOTE:
-                               *bp = QUOTE;
-                               break;
-
-                       default:
-                               if (!isdigit(*s)) {
-                                       *bp++ = QUOTE;
-                                       *bp = *s;
-                               }
-                               r = *s != '0' ? 10 : 8;
-                               for (i = 0; isdigit(*s); s++)
-                                       i = i * r + *s - '0';
-                               s--;
-                               *bp = toascii(i);
-                               break;
-                       }
-               }
-       }
-       *bp = 0;
-
-       len = strlen(buffer) + 1;
-       bp = mh_xmalloc(len);
-       memcpy(bp, buffer, len);
-
-       return bp;
-}
 
 /*
 ** Get the fully qualified name of the local host.
 */
-
 char *
 LocalName(void)
 {
@@ -158,8 +48,6 @@ LocalName(void)
        if (buffer[0])
                return buffer;
 
-       mts_init("mts");
-
        memset(buffer, 0, sizeof(buffer));
 #ifdef HAVE_UNAME
        /* first get our local name */
@@ -187,7 +75,6 @@ LocalName(void)
 ** This is only for UUCP mail.  It gets the hostname
 ** as part of the UUCP "domain".
 */
-
 char *
 SystemName(void)
 {
@@ -201,8 +88,6 @@ SystemName(void)
        if (buffer[0])
                return buffer;
 
-       mts_init("mts");
-
 #ifdef HAVE_UNAME
        uname(&name);
        strncpy(buffer, name.nodename, sizeof(buffer));
@@ -217,7 +102,6 @@ SystemName(void)
 /*
 ** Get the username of current user
 */
-
 char *
 getusername(void)
 {
@@ -232,7 +116,6 @@ getusername(void)
 ** Get full name of current user (typically from GECOS
 ** field of password file).
 */
-
 char *
 getfullname(void)
 {
@@ -314,50 +197,3 @@ getuserinfo(void)
 
        return;
 }
-
-static const char*
-get_mtsconf_pathname(void)
-{
-       const char *cp = getenv( "MHMTSCONF ");
-       if (cp != NULL && *cp != '\0') {
-               return cp;
-       }
-       return mtsconf;
-}
-
-static const char*
-get_mtsuserconf_pathname(void)
-{
-       const char *cp = getenv( "MHMTSUSERCONF" );
-       if (cp != NULL && *cp != '\0') {
-               return cp;
-       }
-       return NULL;
-}
-
-static void
-mts_read_conf_file(FILE *fp)
-{
-       unsigned char *bp;
-       char *cp, buffer[BUFSIZ];
-       struct bind *b;
-
-       while (fgets(buffer, sizeof(buffer), fp)) {
-               if (!(cp = strchr(buffer, '\n')))
-                       break;
-               *cp = 0;
-               if (*buffer == '#' || *buffer == '\0')
-                       continue;
-               if (!(bp = strchr(buffer, ':')))
-                       break;
-               *bp++ = 0;
-               while (isspace(*bp))
-                       *bp++ = 0;
-
-               for (b = binds; b->keyword; b++)
-                       if (strcmp(buffer, b->keyword)==0)
-                               break;
-               if (b->keyword && (cp = tailor_value(bp)))
-                       *b->value = cp;
-       }
-}