-/* Variables for username masquerading: */
-boolean draft_from_masquerading = FALSE;
-static boolean mmailid_masquerading = FALSE;
-boolean username_extension_masquerading = FALSE; /* " from addrsbr.c */
-static char* masquerade = "";
-
-/*
-** Global MailDelivery file
-*/
-char *maildelivery = NMHETCDIR"/maildelivery";
-
-
-/*
-** Aliasing Facility (doesn't belong here)
-*/
-int Everyone = NOTOK;
-static char *everyone = "-1";
-char *NoShell = "";
-
-/*
-** 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[] = {
- { "masquerade", &masquerade },
- { "maildelivery", &maildelivery },
- { "everyone", &everyone },
- { "noshell", &NoShell },
- { 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);
- }
-
- Everyone = atoi(everyone);
-
- if (strstr(masquerade, "draft_from") != NULL)
- draft_from_masquerading = TRUE;
-
- if (strstr(masquerade, "mmailid") != NULL)
- mmailid_masquerading = TRUE;
-
- if (strstr(masquerade, "username_extension") != NULL)
- username_extension_masquerading = TRUE;
-}
-
-
-#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;
-}