+#include <stdio.h>
+#include "auparse.h"
+#include <stdlib.h>
+#include <malloc.h>
int main()
{
auparse_state_t *au;
au = auparse_init(AUSOURCE_LOGS, NULL);
if (au == NULL)
exit(1);
if (!ausearch_set_param(au, "auid", "=", "500", AUSEARCH_STOP_EVENT))
exit(1);
while (ausearch_next_event(au)) {
if (auparse_find_field(au, "auid")) {
printf("auid=%s\n", auparse_interpret_field(au));
}
}
auparse_destroy(au);
}
I tried the above program for but after compilation its giving following linking error.
/tmp/ccMo3ClJ.o: In function `main':
parselib.c:(.text+0x21): undefined reference to `auparse_init'
parselib.c:(.text+0x61): undefined reference to `ausearch_set_param'
parselib.c:(.text+0x84): undefined reference to `auparse_find_field'
parselib.c:(.text+0x93): undefined reference to `auparse_interpret_field'
parselib.c:(.text+0xae): undefined reference to `ausearch_next_event'
parselib.c:(.text+0xbd): undefined reference to `auparse_destroy'
collect2: ld returned 1 exit status
Do help.......