blob: 9fca97bf4fa174c5f24e97b0fab0a2478030041b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "nslog/nslog.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "usage: parse 'filtertext'\n");
return 1;
}
nslog_filter_t *filt;
nslog_error err;
err = nslog_filter_from_text(argv[1], &filt);
if (err != NSLOG_NO_ERROR) {
fprintf(stderr, "Unable to parse.\n");
return 2;
}
char *ct = nslog_filter_sprintf(filt);
filt = nslog_filter_unref(filt);
printf("%s\n", ct);
free(ct);
return 0;
}
|