* Added config.sub and config.guess to the list of files to be
[mmh] / mts / smtp / smtp.c
index f775638..025bb96 100644 (file)
@@ -9,6 +9,12 @@
 #include "smtp.h"
 #include <zotnet/mts/mts.h>
 #include <signal.h>
+#include <h/signals.h>
+#ifdef MPOP
+#include <errno.h>
+#endif
+
+
 
 /*
  * This module implements an interface to SendMail very similar
@@ -71,10 +77,6 @@ static char *sm_moreply = "; ";
 
 struct smtp sm_reply;          /* global... */
 
-#ifdef MPOP
-extern int errno;
-#endif
-
 
 #define        MAXEHLO 20
 
@@ -105,6 +107,8 @@ static int smail_brkany (char, char *);
 char **smail_copyip (char **, char **, int);
 #endif
 
+/* from zotnet/mts/client.c */
+int client (char *, char *, char *, int, char *, int);
 
 int
 sm_init (char *client, char *server, int watch, int verbose,
@@ -126,11 +130,13 @@ sm_init (char *client, char *server, int watch, int verbose,
     if (sm_rfp != NULL && sm_wfp != NULL)
        goto send_options;
 
-    if (client == NULL || *client == '\0')
-       if (clientname)
+    if (client == NULL || *client == '\0') {
+       if (clientname) {
            client = clientname;
-       else
+       } else {
            client = LocalName();       /* no clientname -> LocalName */
+       }
+    }
 
 #ifdef ZMAILER
     if (client == NULL || *client == '\0')
@@ -248,12 +254,16 @@ rclient (char *server, char *protocol, char *service)
                if ((dp = strrchr(*ap, '/')) && *++dp == NULL)
                    *--dp = NULL;
                snprintf (sm_tmpfil, sizeof(sm_tmpfil), "%s/smtpXXXXXX", *ap);
+#ifdef HAVE_MKSTEMP
+               sd = mkstemp (sm_tmpfil);
+#else
                mktemp (sm_tmpfil);
 
                if ((sd = creat (sm_tmpfil, 0600)) != NOTOK) {
                    sm_ispool = 1;
                    break;
                }
+#endif
            }
 
        free (cp);
@@ -1001,16 +1011,17 @@ sm_wstream (char *buffer, int len)
 }
 
 
-#ifdef _AIX
 /*
- * AIX by default will inline the strlen and strcpy commands by redefining
- * them as __strlen and __strcpy respectively.  This causes compile problems
- * with the #ifdef MPOP in the middle.  Should the #ifdef MPOP be removed,
- * remove these #undefs.
+ * On some systems, strlen and strcpy are defined as preprocessor macros.  This
+ * causes compile problems with the #ifdef MPOP in the middle.  Should the
+ * #ifdef MPOP be removed, remove these #undefs.
  */
+#ifdef strlen
 # undef strlen
+#endif
+#ifdef strcpy
 # undef strcpy
-#endif /* _AIX */
+#endif
 
 static int
 sm_werror (void)