diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-08-22 03:24:46 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-08-22 03:24:46 +0200 |
commit | 5809560d858f45351856d6fe786a8117306dd0f2 (patch) | |
tree | b58179567529aba642753cd418c4d98c52dfecbf /src/shared/util.c | |
parent | 35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9 (diff) |
journal: move syslog specific calls out of util.c
Diffstat (limited to 'src/shared/util.c')
-rw-r--r-- | src/shared/util.c | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 1c7e4c6a25..95b577be0e 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -4409,134 +4409,6 @@ bool plymouth_running(void) { return access("/run/plymouth/pid", F_OK) >= 0; } -void syslog_parse_priority(char **p, int *priority) { - int a = 0, b = 0, c = 0; - int k; - - assert(p); - assert(*p); - assert(priority); - - if ((*p)[0] != '<') - return; - - if (!strchr(*p, '>')) - return; - - if ((*p)[2] == '>') { - c = undecchar((*p)[1]); - k = 3; - } else if ((*p)[3] == '>') { - b = undecchar((*p)[1]); - c = undecchar((*p)[2]); - k = 4; - } else if ((*p)[4] == '>') { - a = undecchar((*p)[1]); - b = undecchar((*p)[2]); - c = undecchar((*p)[3]); - k = 5; - } else - return; - - if (a < 0 || b < 0 || c < 0) - return; - - *priority = a*100+b*10+c; - *p += k; -} - -void syslog_skip_pid(char **buf) { - char *p; - - assert(buf); - assert(*buf); - - p = *buf; - - if (*p != '[') - return; - - p++; - p += strspn(p, "0123456789"); - - if (*p != ']') - return; - - p++; - - *buf = p; -} - -void syslog_skip_date(char **buf) { - enum { - LETTER, - SPACE, - NUMBER, - SPACE_OR_NUMBER, - COLON - } sequence[] = { - LETTER, LETTER, LETTER, - SPACE, - SPACE_OR_NUMBER, NUMBER, - SPACE, - SPACE_OR_NUMBER, NUMBER, - COLON, - SPACE_OR_NUMBER, NUMBER, - COLON, - SPACE_OR_NUMBER, NUMBER, - SPACE - }; - - char *p; - unsigned i; - - assert(buf); - assert(*buf); - - p = *buf; - - for (i = 0; i < ELEMENTSOF(sequence); i++, p++) { - - if (!*p) - return; - - switch (sequence[i]) { - - case SPACE: - if (*p != ' ') - return; - break; - - case SPACE_OR_NUMBER: - if (*p == ' ') - break; - - /* fall through */ - - case NUMBER: - if (*p < '0' || *p > '9') - return; - - break; - - case LETTER: - if (!(*p >= 'A' && *p <= 'Z') && - !(*p >= 'a' && *p <= 'z')) - return; - - break; - - case COLON: - if (*p != ':') - return; - break; - - } - } - - *buf = p; -} - char* strshorten(char *s, size_t l) { assert(s); |