2 * Internet mail configurator for Citadel/UX
3 * see copyright.doc for copyright information
17 extern struct config config;
23 extern char ALIASES[128];
24 extern char CIT86NET[128];
25 extern char SENDMAIL[128];
26 extern char FALLBACK[128];
27 extern char GW_DOMAIN[128];
28 extern char TABLEFILE[128];
29 extern int RUN_NETPROC;
31 void StripLeadingAndTrailingWhitespace(char *str) {
32 if (strlen(str) == 0) return;
33 while (isspace(str[0])) strcpy(str, &str[1]);
34 while (isspace(str[strlen(str)-1])) str[strlen(str)-1] = 0;
37 void LoadInternetConfig() {
38 char ParamName[256], ParamValue[256], buf[256];
43 conf = fopen("network/internetmail.config", "r");
45 syslog(LOG_NOTICE, "Couldn't load internetmail.config");
49 while (fgets(buf, 256, conf) != NULL) {
50 if (strlen(buf) > 0) buf[strlen(buf) - 1] = 0;
51 strcpy(ParamName, "");
52 strcpy(ParamValue, "");
55 for (a=strlen(buf); a>=0; --a) {
56 if (buf[a] == '=') eqpos = a;
59 strcpy(ParamName, buf);
61 strcpy(ParamValue, &buf[eqpos+1]);
64 StripLeadingAndTrailingWhitespace(ParamName);
65 StripLeadingAndTrailingWhitespace(ParamValue);
67 if (!strucmp(ParamName, "aliases"))
68 strcpy(ALIASES, ParamValue);
69 if (!strucmp(ParamName, "cit86net spoolin"))
70 strcpy(CIT86NET, ParamValue);
71 if (!strucmp(ParamName, "sendmail"))
72 strcpy(SENDMAIL, ParamValue);
73 if (!strucmp(ParamName, "fallback"))
74 strcpy(FALLBACK, ParamValue);
75 if (!strucmp(ParamName, "gateway domain"))
76 strcpy(GW_DOMAIN, ParamValue);
77 if (!strucmp(ParamName, "table file"))
78 strcpy(TABLEFILE, ParamValue);
79 if (!strucmp(ParamName, "deliver local"))
80 strcpy(metoo[mecount++], ParamValue);
81 if (!strucmp(ParamName, "run netproc"))
82 RUN_NETPROC = atoi(ParamValue);
90 * returns nonzero if the specified host is listed as local
92 int IsHostLocal(char *WhichHost) {
95 if (!strucmp(WhichHost, FQDN)) return(1);
98 for (a=0; a<mecount; ++a) {
99 if (!strucmp(WhichHost, metoo[a])) return(1);