Denis Vlasenko | bd1aeeb | 2008-06-11 15:43:19 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * prioritynames[] and facilitynames[] |
| 4 | * |
| 5 | * Copyright (C) 2008 by Denys Vlasenko <vda.linux@gmail.com> |
| 6 | * |
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 7 | * Licensed under GPLv2, see file LICENSE in this source tree. |
Denis Vlasenko | bd1aeeb | 2008-06-11 15:43:19 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include "libbb.h" |
Denys Vlasenko | e6a2f4c | 2016-04-21 16:26:30 +0200 | [diff] [blame] | 11 | #include "common_bufsiz.h" |
Denis Vlasenko | bd1aeeb | 2008-06-11 15:43:19 +0000 | [diff] [blame] | 12 | #define SYSLOG_NAMES |
| 13 | #define SYSLOG_NAMES_CONST |
| 14 | #include <syslog.h> |
| 15 | |
| 16 | #if 0 |
| 17 | /* For the record: with SYSLOG_NAMES <syslog.h> defines |
| 18 | * (not declares) the following: |
| 19 | */ |
| 20 | typedef struct _code { |
| 21 | /*const*/ char *c_name; |
| 22 | int c_val; |
| 23 | } CODE; |
| 24 | /*const*/ CODE prioritynames[] = { |
| 25 | { "alert", LOG_ALERT }, |
| 26 | ... |
| 27 | { NULL, -1 } |
| 28 | }; |
| 29 | /* same for facilitynames[] */ |
| 30 | |
| 31 | /* This MUST occur only once per entire executable, |
| 32 | * therefore we can't just do it in syslogd.c and logger.c - |
| 33 | * there will be two copies of it. |
| 34 | * |
| 35 | * We cannot even do it in separate file and then just reference |
| 36 | * prioritynames[] from syslogd.c and logger.c - bare <syslog.h> |
| 37 | * will not emit extern decls for prioritynames[]! Attempts to |
| 38 | * emit "matching" struct _code declaration defeat the whole purpose |
| 39 | * of <syslog.h>. |
| 40 | * |
| 41 | * For now, syslogd.c and logger.c are simply compiled into |
| 42 | * one object file. |
| 43 | */ |
| 44 | #endif |
| 45 | |
| 46 | #if ENABLE_SYSLOGD |
| 47 | #include "syslogd.c" |
| 48 | #endif |
| 49 | |
| 50 | #if ENABLE_LOGGER |
| 51 | #include "logger.c" |
| 52 | #endif |