diff -Nru qmail-amavisd-0.9.old/Makefile qmail-amavisd-0.9/Makefile
--- qmail-amavisd-0.9.old/Makefile	Wed Mar 10 09:58:22 2004
+++ qmail-amavisd-0.9/Makefile	Thu Mar 11 20:52:57 2004
@@ -1,5 +1,5 @@
 # $Id: Makefile,v 1.5 2004/03/10 08:58:22 tarkhil Exp $
-CFLAGS	      = -I/usr/local/include
+CFLAGS	      = -I/usr/local/include -Wall
 
 DEST	      = /var/qmail/bin
 
@@ -27,37 +27,11 @@
 
 SRCS	      = qmail-qsmtp.c 
 
-SYSHDRS	      = /usr/include/errno.h \
-		/usr/include/fcntl.h \
-		/usr/include/machine/ansi.h \
-		/usr/include/machine/endian.h \
-		/usr/include/machine/signal.h \
-		/usr/include/machine/trap.h \
-		/usr/include/machine/types.h \
-		/usr/include/machine/ucontext.h \
-		/usr/include/signal.h \
-		/usr/include/stdio.h \
-		/usr/include/stdlib.h \
-		/usr/include/string.h \
-		/usr/include/sys/_posix.h \
-		/usr/include/sys/cdefs.h \
-		/usr/include/sys/inttypes.h \
-		/usr/include/sys/signal.h \
-		/usr/include/sys/stat.h \
-		/usr/include/sys/time.h \
-		/usr/include/sys/types.h \
-		/usr/include/sys/ucontext.h \
-		/usr/include/sys/unistd.h \
-		/usr/include/sys/wait.h \
-		/usr/include/syslog.h \
-		/usr/include/time.h \
-		/usr/include/unistd.h
-
 all:		$(PROGRAM)
 
 $(PROGRAM):     $(OBJS) $(LIBS)
 		@echo "Linking $(PROGRAM) ..."
-		@$(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
+		$(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
 		@echo "done"
 
 clean:;		@rm -f $(OBJS) core
@@ -79,26 +53,3 @@
 print:;		@$(PRINT) $(HDRS) $(SRCS)
 
 tags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
-###
-qmail-qsmtp.o: /usr/include/unistd.h /usr/include/sys/cdefs.h \
-	/usr/include/sys/types.h /usr/include/sys/inttypes.h \
-	/usr/include/machine/ansi.h /usr/include/machine/types.h \
-	/usr/include/machine/endian.h /usr/include/sys/unistd.h \
-	/usr/include/sys/_posix.h /usr/include/stdio.h /usr/include/stdlib.h \
-	/usr/include/signal.h /usr/include/sys/signal.h \
-	/usr/include/machine/signal.h /usr/include/machine/trap.h \
-	/usr/include/sys/ucontext.h /usr/include/machine/ucontext.h \
-	/usr/include/sys/time.h /usr/include/time.h /usr/include/string.h \
-	/usr/include/sys/stat.h /usr/include/fcntl.h /usr/include/sys/wait.h \
-	/usr/include/syslog.h /usr/include/errno.h
-qmail-xqueue.o: /usr/include/unistd.h /usr/include/sys/cdefs.h \
-	/usr/include/sys/types.h /usr/include/sys/inttypes.h \
-	/usr/include/machine/ansi.h /usr/include/machine/types.h \
-	/usr/include/machine/endian.h /usr/include/sys/unistd.h \
-	/usr/include/sys/_posix.h /usr/include/stdio.h /usr/include/stdlib.h \
-	/usr/include/signal.h /usr/include/sys/signal.h \
-	/usr/include/machine/signal.h /usr/include/machine/trap.h \
-	/usr/include/sys/ucontext.h /usr/include/machine/ucontext.h \
-	/usr/include/sys/time.h /usr/include/time.h /usr/include/string.h \
-	/usr/include/sys/stat.h /usr/include/fcntl.h /usr/include/sys/wait.h \
-	/usr/include/syslog.h /usr/include/errno.h
diff -Nru qmail-amavisd-0.9.old/qmail-qsmtp.c qmail-amavisd-0.9/qmail-qsmtp.c
--- qmail-amavisd-0.9.old/qmail-qsmtp.c	Wed Mar 10 09:58:23 2004
+++ qmail-amavisd-0.9/qmail-qsmtp.c	Thu Mar 11 20:53:35 2004
@@ -19,6 +19,7 @@
 #include <sys/socket.h>
 #include <unp.h>
 #include <stdarg.h>
+#include <netinet/in.h>
 
 #define SERVADDR "127.0.0.1"
 #define SERVPORT 10024
@@ -74,7 +75,6 @@
 #define BUFSIZE 4096
   char buffer[BUFSIZE+1];
   int nread, nwrite = 0;
-  const char ** ep;
   while ((nread = read(from, buffer, BUFSIZE)) != 0) {
     nwrite++;
     if (nread < 0) 
@@ -163,13 +163,11 @@
 
 int main(int argc, char ** argv, char **envp) 
 {
-    pid_t pid;
     char * envbuf = NULL;
     char * envelope;
     int envlen = 0;
     char buffer[BUFSIZE];
     int r_len;
-    int efd;
     int sockfd;
     smtp_reply servreply;
     struct sockaddr_in server;
@@ -180,11 +178,11 @@
     const char * data = "DATA";
     const char * dot = ".";
     const char * quit = "QUIT";
-    struct hostent *hp;
     int frombuf = 0;
-    int attempt = 0;
+#ifdef TRY_ENVELOPE_FIRST
     fd_set setdebug;
     struct timeval tmout;
+#endif
     envptr = envp;
     openlog ("qmail-qsmtp", LOG_PID | LOG_NDELAY, LOG_MAIL); 
     dumpenv();
@@ -210,7 +208,7 @@
 	syslog(LOG_INFO,"Descriptor 0 is ready");
 #endif
 	/* I'll have to buffer input file :-( */
-	sprintf(buffer, "/tmp/tmp-queue.%ld", getpid());
+	sprintf(buffer, "/tmp/tmp-queue.%ld", (long int)getpid());
 	if ((frombuf = open(buffer, O_CREAT|O_RDWR|O_EXCL, 0600)) < 0) {
 	  die_errno(81, "cannot create tempfile");
 	}
@@ -233,10 +231,8 @@
     switch (select(1,&setdebug, NULL, NULL, &tmout)) {
     case -1:
       die_errno(81, "Select failed");
-    case 0:
+    // case 0:
       //      die_status(81, "Fatal timeout in select");
-    default:
-      /* happy */
     }
 #endif
     while ((r_len = read(1, buffer, BUFSIZE)) != 0) {
@@ -257,7 +253,7 @@
     if (inet_pton(AF_INET, SERVADDR, &server.sin_addr) <= 0) {
 	die_errno(81, "inet_pton failed");
     }
-    if (connect(sockfd, (SA *)&server, sizeof(server)) < 0) {
+    if (connect(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) {
 	die_errno(81, "connect failed");
     }
     syslog(LOG_DEBUG, "Connected to SMTP");
