socks5-1.0.11_3 failed to compile and install rftp and rtelnetproperly, PATCHES INCLUDED!

Kiyo Kelvin Lee kiyo at pacific.net.au
Wed May 12 06:49:35 PDT 2004


For FreeBSD 5.2.1 with gcc 3.3.3, socks5-1.0.11_3 failed to compile and 
install rftp and rtelnet properly.
Basically, the problem is that varargs.h is no longer useful for gcc 3.3.3.
So the attached patches can be used to fix the files: clients/ftp/ftp.c, 
clients/telnet/telnet.c, clients/telnet/commands.c to use stdarg.h instead.
Regards,
Kiyo
-------------- next part --------------
--- clients/telnet/commands.c.orig	Thu Aug 17 01:38:46 2000
+++ clients/telnet/commands.c	Wed May 12 23:14:53 2004
@@ -83,9 +83,14 @@
 #include <signal.h>
 #include <ctype.h>
 #include <pwd.h>
-#include <varargs.h>
 #include <errno.h>
 
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
 #include <arpa/telnet.h>
 
 #include "general.h"
@@ -122,7 +127,13 @@
 extern int Ambiguous();
 extern void herror();
 
+typedef int (*intrtn_t)();
+
+#ifdef HAVE_STDARG_H
+static int call(intrtn_t routine, ...);
+#else
 static int call();
+#endif
 
 typedef struct {
     char *name;		/* command name */
@@ -2092,17 +2103,26 @@
 
     /*VARARGS1*/
     static int
-call(va_alist)
-    va_dcl
+call
+#ifdef HAVE_STDARG_H
+(intrtn_t routine, ...)
+#else
+(va_alist) va_dcl
+#endif
 {
     va_list ap;
-    typedef int (*intrtn_t)();
+#ifndef HAVE_STDARG_H
     intrtn_t routine;
+#endif
     char *args[100];
     int argno = 0;
 
+#ifdef HAVE_STDARG_H
+    va_start(ap, routine);
+#else
     va_start(ap);
     routine = (va_arg(ap, intrtn_t));
+#endif
     while ((args[argno++] = va_arg(ap, char *)) != 0) {
 	;
     }
-------------- next part --------------
--- clients/telnet/telnet.c.orig	Thu Aug 17 01:38:48 2000
+++ clients/telnet/telnet.c	Wed May 12 23:13:16 2004
@@ -179,18 +179,34 @@
 
 
 #ifdef	notdef
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#else
 #include <varargs.h>
+#endif
 
 /*VARARGS*/
-static void printring(va_alist) va_dcl {
+static void
+printring
+#ifdef HAVE_STDARG_H
+(Ring *ring, ...)
+#else
+(va_alist) va_dcl
+#endif
+{
     char buffer[100], char *ptr, char *format, char *string;
+#ifndef HAVE_STDARG_H
     Ring *ring;
+#endif
     va_list ap;
     int i;
 
+#ifdef HAVE_STDARG_H
+    va_start(ap, ring);
+#else
     va_start(ap);
-
     ring   = va_arg(ap, Ring *);
+#endif
     format = va_arg(ap, char *);
     ptr    = buffer;
 
@@ -219,6 +235,8 @@
 	}
     }
     ring_supply_data(ring, buffer, ptr-buffer);
+
+    va_end(ap);
 }
 #endif
 
-------------- next part --------------
--- clients/ftp/ftp.c.orig	Thu Aug 17 01:38:44 2000
+++ clients/ftp/ftp.c	Wed May 12 23:10:49 2004
@@ -48,7 +48,11 @@
 #include <fcntl.h>
 #endif
 
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#else
 #include <varargs.h>
+#endif
 
 #ifdef FASCIST
 #include <syslog.h>
@@ -241,9 +245,18 @@
 }
 
 /*VARARGS*/
-int command(va_alist) va_dcl {
+int
+command
+#ifdef HAVE_STDARG_H
+(const char *fmt, ...)
+#else
+(va_alist) va_dcl
+#endif
+{
     va_list ap;
+#ifndef HAVE_STDARG_H
     char *fmt;
+#endif
     int r;
     Sig_t oldintr;
     
@@ -251,8 +264,12 @@
     if (debug) {
 	printf("---> ");
 
+#ifdef HAVE_STDARG_H
+        va_start(ap, fmt);
+#else
 	va_start(ap);
 	fmt = va_arg(ap, char *);
+#endif
 	if (strncmp("PASS ", fmt, 5) == 0)
 	    printf("PASS XXXX");
 	else 
@@ -271,8 +288,12 @@
 
     oldintr = Signal(SIGINT, cmdabort);
 
+#ifdef HAVE_STDARG_H
+    va_start(ap, fmt);
+#else
     va_start(ap);
     fmt = va_arg(ap, char *);
+#endif
     vfprintf(cout, fmt, ap);
     va_end(ap);
 


More information about the freebsd-ports mailing list