varargs -> stdarg

This commit is contained in:
espie 2004-01-05 03:32:11 +00:00
parent 6c413dcf3d
commit e545d61cbe
2 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-clients_ftp_ftp_c,v 1.1 2004/01/05 03:32:11 espie Exp $
--- clients/ftp/ftp.c.orig 2004-01-05 04:24:46.000000000 +0100
+++ clients/ftp/ftp.c 2004-01-05 04:25:42.000000000 +0100
@@ -48,7 +48,7 @@
#include <fcntl.h>
#endif
-#include <varargs.h>
+#include <stdarg.h>
#ifdef FASCIST
#include <syslog.h>
@@ -241,9 +241,8 @@ void cmdabort() {
}
/*VARARGS*/
-int command(va_alist) va_dcl {
+int command(char *fmt, ...) {
va_list ap;
- char *fmt;
int r;
Sig_t oldintr;
@@ -251,8 +250,7 @@ int command(va_alist) va_dcl {
if (debug) {
printf("---> ");
- va_start(ap);
- fmt = va_arg(ap, char *);
+ va_start(ap, fmt);
if (strncmp("PASS ", fmt, 5) == 0)
printf("PASS XXXX");
else
@@ -271,8 +269,7 @@ int command(va_alist) va_dcl {
oldintr = Signal(SIGINT, cmdabort);
- va_start(ap);
- fmt = va_arg(ap, char *);
+ va_start(ap, fmt);
vfprintf(cout, fmt, ap);
va_end(ap);

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-clients_telnet_commands_c,v 1.1 2004/01/05 03:32:11 espie Exp $
--- clients/telnet/commands.c.orig 2000-08-16 17:38:46.000000000 +0200
+++ clients/telnet/commands.c 2004-01-05 04:28:51.000000000 +0100
@@ -83,7 +83,7 @@ static char sccsid[] = "@(#)commands.c 8
#include <signal.h>
#include <ctype.h>
#include <pwd.h>
-#include <varargs.h>
+#include <stdarg.h>
#include <errno.h>
#include <arpa/telnet.h>
@@ -122,7 +122,8 @@ extern char **genget();
extern int Ambiguous();
extern void herror();
-static int call();
+typedef int (*intrtn_t)();
+static int call(intrtn_t, ...);
typedef struct {
char *name; /* command name */
@@ -2092,17 +2093,13 @@ static Command cmdtab2[] = {
/*VARARGS1*/
static int
-call(va_alist)
- va_dcl
+call(intrtn_t routine, ...)
{
va_list ap;
- typedef int (*intrtn_t)();
- intrtn_t routine;
char *args[100];
int argno = 0;
- va_start(ap);
- routine = (va_arg(ap, intrtn_t));
+ va_start(ap, routine);
while ((args[argno++] = va_arg(ap, char *)) != 0) {
;
}