+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,
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 *);
#include <sys/time.h>
#endif
#include <stdio.h>
+#include <stdarg.h>
#include "krb4int.h"
#include <klog.h>
* 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;
}