3
0

syslogd_and_logger.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. *
  7. * Licensed under GPLv2, see file LICENSE in this source tree.
  8. */
  9. #include "libbb.h"
  10. #include "common_bufsiz.h"
  11. #define SYSLOG_NAMES
  12. #define SYSLOG_NAMES_CONST
  13. #include <syslog.h>
  14. #if 0
  15. /* For the record: with SYSLOG_NAMES <syslog.h> defines
  16. * (not declares) the following:
  17. */
  18. typedef struct _code {
  19. /*const*/ char *c_name;
  20. int c_val;
  21. } CODE;
  22. /*const*/ CODE prioritynames[] = {
  23. { "alert", LOG_ALERT },
  24. ...
  25. { NULL, -1 }
  26. };
  27. /* same for facilitynames[] */
  28. /* This MUST occur only once per entire executable,
  29. * therefore we can't just do it in syslogd.c and logger.c -
  30. * there will be two copies of it.
  31. *
  32. * We cannot even do it in separate file and then just reference
  33. * prioritynames[] from syslogd.c and logger.c - bare <syslog.h>
  34. * will not emit extern decls for prioritynames[]! Attempts to
  35. * emit "matching" struct _code declaration defeat the whole purpose
  36. * of <syslog.h>.
  37. *
  38. * For now, syslogd.c and logger.c are simply compiled into
  39. * one object file.
  40. */
  41. #endif
  42. #if ENABLE_SYSLOGD
  43. #include "syslogd.c"
  44. #endif
  45. #if ENABLE_LOGGER
  46. #include "logger.c"
  47. #endif