* log.c: Include stdarg.h.
authorKen Raeburn <raeburn@mit.edu>
Tue, 30 Jul 2002 23:41:45 +0000 (23:41 +0000)
committerKen Raeburn <raeburn@mit.edu>
Tue, 30 Jul 2002 23:41:45 +0000 (23:41 +0000)
(krb_log): Use va_ macros and vfprintf instead of a bunch of pointer arguments.
* krb4int.h (krb_log): Declaration updated.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14675 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb4/ChangeLog
src/lib/krb4/krb4int.h
src/lib/krb4/log.c

index d25e6fac179c22798b5cc7022f4f53c982eb4ad2..0f92590168f6fc0b0bf7e2a7fc9372971a4c50eb 100644 (file)
@@ -1,3 +1,10 @@
+2002-07-30  Ken Raeburn  <raeburn@mit.edu>
+
+       * log.c: Include stdarg.h.
+       (krb_log): Use va_ macros and vfprintf instead of a bunch of
+       pointer arguments.
+       * krb4int.h (krb_log): Declaration updated.
+
 2002-07-12  Ken Raeburn  <raeburn@mit.edu>
 
        * ad_print.c, g_phost.c, g_tkt_svc.c, gethostname.c, mac_glue.c,
index ecffcf1907ecdd0969935155c63132a85745f103..54499d20f19150f38da8fc478a1680dcf3b040f8 100644 (file)
@@ -29,8 +29,7 @@ int k_gethostname(char *, int);
 void kset_logfile(char *);
 
 /* log.c */
-void krb_log(char *, char *, char *, char *, char *, char *, char *, 
-            char *, char *, char *, char *);
+void krb_log(const char *, ...);
 
 void krb_set_logfile(char *);
 
index 24cf1b18d80da1b1fe8a9c2787cde542d97c076d..aabcf83cc307799ac7dd8bd5f4d4c2160fecf5a4 100644 (file)
@@ -23,6 +23,7 @@
 #include <sys/time.h>
 #endif
 #include <stdio.h>
+#include <stdarg.h>
 
 #include "krb4int.h"
 #include <klog.h>
@@ -53,27 +54,27 @@ static is_open;
  * The return value is undefined.
  */
 
-/*VARARGS1 */
-void krb_log(format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0)
-    char *format;
-    char *a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a0;
+void krb_log(const char *format,...)
 {
     FILE *logfile;
     time_t now;
     struct tm *tm;
+    va_list args;
 
-    if ((logfile = fopen(log_name,"a")) == NULL)
-        return;
+    va_start(args, format);
 
-    (void) time(&now);
-    tm = localtime(&now);
+    if ((logfile = fopen(log_name,"a")) != NULL) {
+       (void) time(&now);
+       tm = localtime(&now);
 
-    fprintf(logfile,"%2d-%s-%d %02d:%02d:%02d ",tm->tm_mday,
-            month_sname(tm->tm_mon + 1),1900+tm->tm_year,
-            tm->tm_hour, tm->tm_min, tm->tm_sec);
-    fprintf(logfile,format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0);
-    fprintf(logfile,"\n");
-    (void) fclose(logfile);
+       fprintf(logfile,"%2d-%s-%d %02d:%02d:%02d ",tm->tm_mday,
+               month_sname(tm->tm_mon + 1),1900+tm->tm_year,
+               tm->tm_hour, tm->tm_min, tm->tm_sec);
+       vfprintf(logfile,format,args);
+       fprintf(logfile,"\n");
+       (void) fclose(logfile);
+    }
+    va_end(args);
     return;
 }