diff options
author | markm <markm@FreeBSD.org> | 2000-02-24 14:29:47 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2000-02-24 14:29:47 +0000 |
commit | 606d31b1ec502ee62ab4644dfa593b00666d18f7 (patch) | |
tree | 91ed89b104320a49c955f13cbb87995ba86dcf3c /crypto/openssh/log-client.c | |
parent | be16c6202adb7544b9017594a51ceb85b3b65692 (diff) | |
parent | fc557ff7d97438559e69347575f5aa8ef03a5f50 (diff) | |
download | FreeBSD-src-606d31b1ec502ee62ab4644dfa593b00666d18f7.zip FreeBSD-src-606d31b1ec502ee62ab4644dfa593b00666d18f7.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r57429,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'crypto/openssh/log-client.c')
-rw-r--r-- | crypto/openssh/log-client.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/crypto/openssh/log-client.c b/crypto/openssh/log-client.c new file mode 100644 index 0000000..62709d9 --- /dev/null +++ b/crypto/openssh/log-client.c @@ -0,0 +1,62 @@ +/* + * + * log-client.c + * + * Author: Tatu Ylonen <ylo@cs.hut.fi> + * + * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland + * All rights reserved + * + * Created: Mon Mar 20 21:13:40 1995 ylo + * + * Client-side versions of debug(), log(), etc. These print to stderr. + * This is a stripped down version of log-server.c. + * + */ + +#include "includes.h" +RCSID("$Id: log-client.c,v 1.6 1999/11/24 00:26:02 deraadt Exp $"); + +#include "xmalloc.h" +#include "ssh.h" + +static LogLevel log_level = SYSLOG_LEVEL_INFO; + +/* Initialize the log. + * av0 program name (should be argv[0]) + * level logging level + */ + +void +log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2) +{ + switch (level) { + case SYSLOG_LEVEL_QUIET: + case SYSLOG_LEVEL_ERROR: + case SYSLOG_LEVEL_FATAL: + case SYSLOG_LEVEL_INFO: + case SYSLOG_LEVEL_VERBOSE: + case SYSLOG_LEVEL_DEBUG: + log_level = level; + break; + default: + /* unchanged */ + break; + } +} + +#define MSGBUFSIZE 1024 + +void +do_log(LogLevel level, const char *fmt, va_list args) +{ + char msgbuf[MSGBUFSIZE]; + + if (level > log_level) + return; + if (level == SYSLOG_LEVEL_DEBUG) + fprintf(stderr, "debug: "); + vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); + fprintf(stderr, "%s", msgbuf); + fprintf(stderr, "\r\n"); +} |