From f06aecfc1c653435fa3a999080100ec0e9c6072c Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Thu, 11 Jan 1996 16:33:11 +0000 Subject: [PATCH] * krcp.c (error): Convert to use varargs * configure.in: Check for stdarg.h git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7308 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 6 ++++++ src/appl/bsd/configure.in | 4 +++- src/appl/bsd/krcp.c | 34 ++++++++++++++++++++++++++++------ 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index f05c9a983..f6ab0efe1 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,9 @@ +Thu Jan 11 11:27:04 1996 Ezra Peisach + + * krcp.c (error): Convert to use varargs. + + * configure.in: Check for stdarg.h + Wed Jan 10 21:26:20 1996 Theodore Y. Ts'o * kcmd.c (getport): Clear the sin structure to be zero. (From diff --git a/src/appl/bsd/configure.in b/src/appl/bsd/configure.in index b6114736e..114d29547 100644 --- a/src/appl/bsd/configure.in +++ b/src/appl/bsd/configure.in @@ -52,7 +52,9 @@ AC_FUNC_CHECK(grantpt,AC_DEFINE(HAVE_GRANTPT)) AC_FUNC_CHECK(openpty,AC_DEFINE(HAVE_OPENPTY)) AC_FUNC_CHECK(setlogin,AC_DEFINE(HAVE_SETLOGIN)) AC_FUNC_CHECK(logwtmp,AC_DEFINE(HAVE_LOGWTMP)) -AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/filio.h sys/sockio.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h utmp.h utmpx.h) +AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/filio.h sys/sockio.h) +AC_CHECK_HEADERS(sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h) +AC_CHECK_HEADERS(sys/ptyvar.h utmp.h utmpx.h stdarg.h) AC_REPLACE_FUNCS(getdtablesize) DECLARE_SYS_ERRLIST KRB5_SIGTYPE diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index 42bb65591..e47c0fd94 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -57,6 +57,11 @@ char copyright[] = #ifdef HAVE_VFORK_H #include #endif +#ifdef HAVE_STDARG_H +#include +#else +#include +#endif #ifdef HAVE_SETRESUID #ifndef HAVE_SETREUID @@ -126,8 +131,12 @@ struct buffer { #define NULLBUF (struct buffer *) 0 - /*VARARGS*/ - int error(); +#ifdef HAVE_STDARG_H +int error KRB5_PROTOTYPE((char *fmt, ...)); +#else +/*VARARGS*/ +int error KRB5_PROTOTYPE((char *, va_list)); +#endif #define ga() (void) des_write(rem, "", 1) @@ -1118,16 +1127,29 @@ struct buffer *allocbuf(bp, fd, blksize) +#ifdef HAVE_STDARG_H +error(char *fmt, ...) +#else /*VARARGS1*/ -error(fmt, a1, a2, a3, a4, a5) +error(fmt, va_alist) char *fmt; - int a1, a2, a3, a4, a5; + va_dcl +#endif { + va_list ap; char buf[RCP_BUFSIZ], *cp = buf; - + +#ifdef HAVE_STDARG_H + va_start(ap, fmt); +#else + va_start(ap); +#endif + errs++; *cp++ = 1; - (void) sprintf(cp, fmt, a1, a2, a3, a4, a5); + (void) vsprintf(cp, fmt, ap); + va_end(ap); + (void) des_write(rem, buf, strlen(buf)); if (iamremote == 0) (void) write(2, buf+1, strlen(buf+1)); -- 2.26.2