]> code.citadel.org Git - citadel.git/blobdiff - citadel/internetmail.c
* Changed the comments at the beginning of each file to a consistent format
[citadel.git] / citadel / internetmail.c
index 351f63f111a1b6a5b1dc6de51c4ba1d4051497bb..36dbecc7c43488b528a1bb550d6dd0a760caed2f 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * $Id$
+ *
  * Internet mail configurator for Citadel/UX
  * see copyright.doc for copyright information
  *
@@ -16,7 +18,6 @@
 
 extern struct config config;
 
-int struncmp();
 char metoo[10][128];
 int mecount = 0;
 
@@ -28,13 +29,18 @@ extern char GW_DOMAIN[128];
 extern char TABLEFILE[128];
 extern int RUN_NETPROC;
 
-void StripLeadingAndTrailingWhitespace(char *str) {
-       if (strlen(str) == 0) return;
-       while (isspace(str[0])) strcpy(str, &str[1]);
-       while (isspace(str[strlen(str)-1])) str[strlen(str)-1] = 0;
-       }
+void StripLeadingAndTrailingWhitespace(char *str)
+{
+       if (strlen(str) == 0)
+               return;
+       while (isspace(str[0]))
+               strcpy(str, &str[1]);
+       while (isspace(str[strlen(str) - 1]))
+               str[strlen(str) - 1] = 0;
+}
 
-void LoadInternetConfig() {
+void LoadInternetConfig(void)
+{
        char ParamName[256], ParamValue[256], buf[256];
        FILE *conf;
        int a, eqpos;
@@ -44,61 +50,63 @@ void LoadInternetConfig() {
        if (conf == NULL) {
                syslog(LOG_NOTICE, "Couldn't load internetmail.config");
                exit(1);
-               }
-
+       }
        while (fgets(buf, 256, conf) != NULL) {
-               if (strlen(buf) > 0) buf[strlen(buf) - 1] = 0;
+               if (strlen(buf) > 0)
+                       buf[strlen(buf) - 1] = 0;
                strcpy(ParamName, "");
                strcpy(ParamValue, "");
                if (buf[0] != '#') {
                        eqpos = (-1);
-                       for (a=strlen(buf); a>=0; --a) {
-                               if (buf[a] == '=') eqpos = a;
-                               }
+                       for (a = strlen(buf); a >= 0; --a) {
+                               if (buf[a] == '=')
+                                       eqpos = a;
+                       }
                        if (eqpos >= 0) {
                                strcpy(ParamName, buf);
                                ParamName[eqpos] = 0;
-                               strcpy(ParamValue, &buf[eqpos+1]);
-                               }
-
+                               strcpy(ParamValue, &buf[eqpos + 1]);
+                       }
                        StripLeadingAndTrailingWhitespace(ParamName);
                        StripLeadingAndTrailingWhitespace(ParamValue);
 
-                       if (!strucmp(ParamName, "aliases"))
+                       if (!strcasecmp(ParamName, "aliases"))
                                strcpy(ALIASES, ParamValue);
-                       if (!strucmp(ParamName, "cit86net spoolin"))
+                       if (!strcasecmp(ParamName, "cit86net spoolin"))
                                strcpy(CIT86NET, ParamValue);
-                       if (!strucmp(ParamName, "sendmail"))
+                       if (!strcasecmp(ParamName, "sendmail"))
                                strcpy(SENDMAIL, ParamValue);
-                       if (!strucmp(ParamName, "fallback"))
+                       if (!strcasecmp(ParamName, "fallback"))
                                strcpy(FALLBACK, ParamValue);
-                       if (!strucmp(ParamName, "gateway domain"))
+                       if (!strcasecmp(ParamName, "gateway domain"))
                                strcpy(GW_DOMAIN, ParamValue);
-                       if (!strucmp(ParamName, "table file"))
+                       if (!strcasecmp(ParamName, "table file"))
                                strcpy(TABLEFILE, ParamValue);
-                       if (!strucmp(ParamName, "deliver local"))
+                       if (!strcasecmp(ParamName, "deliver local"))
                                strcpy(metoo[mecount++], ParamValue);
-                       if (!strucmp(ParamName, "run netproc")) 
+                       if (!strcasecmp(ParamName, "run netproc"))
                                RUN_NETPROC = atoi(ParamValue);
-                       }
                }
-       fclose(conf);
        }
+       fclose(conf);
+}
 
 
 /* 
  * returns nonzero if the specified host is listed as local
  */
-int IsHostLocal(char *WhichHost) {
+int IsHostLocal(char *WhichHost)
+{
        int a;
 
-       if (!strucmp(WhichHost, FQDN)) return(1);
+       if (!strcasecmp(WhichHost, FQDN))
+               return (1);
 
        if (mecount > 0) {
-               for (a=0; a<mecount; ++a) {
-                       if (!strucmp(WhichHost, metoo[a])) return(1);
-                       }
+               for (a = 0; a < mecount; ++a) {
+                       if (!strcasecmp(WhichHost, metoo[a]))
+                               return (1);
                }
-       
-       return(0);
        }
+       return (0);
+}