test-journal-syslog.c revision a187bfd98ae7b651f7c464450895ead6bdf1ddd6
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering This file is part of systemd.
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering Copyright 2011 Lennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering systemd is free software; you can redistribute it and/or modify it
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering under the terms of the GNU Lesser General Public License as published by
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering (at your option) any later version.
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering systemd is distributed in the hope that it will be useful, but
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering Lesser General Public License for more details.
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering You should have received a copy of the GNU Lesser General Public License
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poetteringstatic void test_syslog_parse_identifier(const char* str,
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering const char *ident, const char*pid, int ret) {
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering char _cleanup_free_ *ident2 = NULL, *pid2 = NULL;
0b452006de98294d1690f045f6ea2f7f6630ec3bRonny Chevalier ret2 = syslog_parse_identifier(&buf, &ident2, &pid2);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering assert(ident==ident2 || streq(ident, ident2));
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering test_syslog_parse_identifier("pidu[111]: xxx", "pidu", "111", 11);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering test_syslog_parse_identifier("pidu: xxx", "pidu", NULL, 6);