diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 1999-11-23 22:25:57 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 1999-11-23 22:25:57 +0000 |
commit | 5ca3ea35d495a05b1f8e3de30ab8e5f9e71845ec (patch) | |
tree | ae22941656d7fb2dfb68fde85e2e8f68fef73b29 /usr.bin/ssh/log-client.c | |
parent | 0d292d99c753a8b6641ad11989bd9861de4e1156 (diff) |
KNF part 1
Diffstat (limited to 'usr.bin/ssh/log-client.c')
-rw-r--r-- | usr.bin/ssh/log-client.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/usr.bin/ssh/log-client.c b/usr.bin/ssh/log-client.c index 97e253062e7..0a109ece78e 100644 --- a/usr.bin/ssh/log-client.c +++ b/usr.bin/ssh/log-client.c @@ -15,7 +15,7 @@ This is a stripped down version of log-server.c. */ #include "includes.h" -RCSID("$Id: log-client.c,v 1.4 1999/11/22 21:02:38 markus Exp $"); +RCSID("$Id: log-client.c,v 1.5 1999/11/23 22:25:53 markus Exp $"); #include "xmalloc.h" #include "ssh.h" @@ -23,27 +23,26 @@ RCSID("$Id: log-client.c,v 1.4 1999/11/22 21:02:38 markus Exp $"); static LogLevel log_level = SYSLOG_LEVEL_INFO; /* Initialize the log. - av0 program name (should be argv[0]) - level logging level - */ + * 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; - } + 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 @@ -51,13 +50,13 @@ log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2) 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"); + 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"); } |