summaryrefslogtreecommitdiff
path: root/xio.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-04 10:02:59 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-04 10:02:59 +0200
commit22e4551cb007312ef808669aa70cad10a7657136 (patch)
tree6e0b8ee7ddb4e30865813d704fa7f5de1a0796d9 /xio.c
parent0f1f8ccf43e1296725cfbef482d19c90b15af98c (diff)
xio: refactor fopencookie related functions
Again, we move them out of xio to shrink it down. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'xio.c')
-rw-r--r--xio.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/xio.c b/xio.c
index da17206..efc4ed4 100644
--- a/xio.c
+++ b/xio.c
@@ -157,48 +157,3 @@ ssize_t write_exact(int fd, void *buf, size_t len, int mayexit)
return num;
}
-
-static char const *priov[] = {
- [LOG_EMERG] = "EMERG:",
- [LOG_ALERT] = "ALERT:",
- [LOG_CRIT] = "CRIT:",
- [LOG_ERR] = "ERR:",
- [LOG_WARNING] = "WARNING:",
- [LOG_NOTICE] = "NOTICE:",
- [LOG_INFO] = "INFO:",
- [LOG_DEBUG] = "DEBUG:",
-};
-
-static ssize_t cookie_writer(void *cookie, char const *data, size_t leng)
-{
- int prio = LOG_DEBUG, len;
-
- do {
- len = strlen(priov[prio]);
- } while (memcmp(data, priov[prio], len) && --prio >= 0);
-
- if (prio < 0) {
- prio = LOG_INFO;
- } else {
- data += len;
- leng -= len;
- }
-
- while (*data == ' ') {
- ++data;
- --leng;
- }
-
- syslog(prio, "%.*s", (int) leng, data);
-
- return leng;
-}
-
-static cookie_io_functions_t cookie_log = {
- .write = cookie_writer,
-};
-
-void to_std_log(FILE **fp)
-{
- setvbuf(*fp = fopencookie(NULL, "w", cookie_log), NULL, _IOLBF, 0);
-}