* krcp.c (error): Convert to use varargs
authorEzra Peisach <epeisach@mit.edu>
Thu, 11 Jan 1996 16:33:11 +0000 (16:33 +0000)
committerEzra Peisach <epeisach@mit.edu>
Thu, 11 Jan 1996 16:33:11 +0000 (16:33 +0000)
* 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
src/appl/bsd/configure.in
src/appl/bsd/krcp.c

index f05c9a983548e0542e628ef81e33559f5f313fdc..f6ab0efe1f6ae4483b7d147aa7f35ace0f60f281 100644 (file)
@@ -1,3 +1,9 @@
+Thu Jan 11 11:27:04 1996  Ezra Peisach  <epeisach@kangaroo.mit.edu>
+
+       * krcp.c (error): Convert to use varargs.
+
+       * configure.in: Check for stdarg.h
+
 Wed Jan 10 21:26:20 1996  Theodore Y. Ts'o  <tytso@dcl>
 
        * kcmd.c (getport): Clear the sin structure to be zero.  (From
index b6114736e4cd2663fa985b70a9355c1350b54c25..114d29547e9b6349b58063c834b15f7183280fbd 100644 (file)
@@ -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
index 42bb65591df7ffd2197871f7abf6cf0371058955..e47c0fd94fe98317c133cdb4bbc3c33ca84ebfeb 100644 (file)
@@ -57,6 +57,11 @@ char copyright[] =
 #ifdef HAVE_VFORK_H
 #include <vfork.h>
 #endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#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));