Merge from vendor branch NCURSES:
[dragonfly.git] / crypto / heimdal-0.6.3 / appl / popper / pop_log.c
1 /*
2  * Copyright (c) 1989 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6
7 #include <popper.h>
8 RCSID("$Id: pop_log.c,v 1.13 1997/10/14 21:59:07 joda Exp $");
9
10 /* 
11  *  log:    Make a log entry
12  */
13
14 int
15 pop_log(POP *p, int stat, char *format, ...)
16 {
17     char msgbuf[MAXLINELEN];
18     va_list     ap;
19
20     va_start(ap, format);
21     vsnprintf(msgbuf, sizeof(msgbuf), format, ap);
22
23     if (p->debug && p->trace) {
24         fprintf(p->trace,"%s\n",msgbuf);
25         fflush(p->trace);
26     } else {
27 #ifdef KRB5
28         krb5_log(p->context, p->logf, stat, "%s", msgbuf);
29 #else
30         syslog (stat,"%s",msgbuf);
31 #endif
32     }
33     va_end(ap);
34
35     return(stat);
36 }