Author: marek Date: 2010-01-26 04:21:47 +0100 (Tue, 26 Jan 2010) New Revision: 1567
Modified: trunk/batctl/functions.c trunk/batctl/sys.c Log: batctl: omit log lines which don't start with the correct tag
All batman-adv log messages start with a distinct tag ("batman-adv:" at the moment) which we can use to strip the kernel log and only show batman-adv related messages.
Modified: trunk/batctl/functions.c =================================================================== --- trunk/batctl/functions.c 2010-01-25 09:25:47 UTC (rev 1566) +++ trunk/batctl/functions.c 2010-01-26 03:21:47 UTC (rev 1567) @@ -35,6 +35,7 @@ #include "functions.h" #include "bat-hosts.h"
+#define BATMAN_ADV_TAG "batman-adv:"
static struct timeval start_time; static char *host_name; @@ -178,6 +179,12 @@ if (read_opt & USE_READ_BUFF) break;
+ if (read_opt & LOG_MODE) { + /* omit log lines which don't start with the correct tag */ + if (strncmp(line_ptr, BATMAN_ADV_TAG, strlen(BATMAN_ADV_TAG)) != 0) + continue; + } + if (!(read_opt & USE_BAT_HOSTS)) { printf("%s", line_ptr); continue;
Modified: trunk/batctl/sys.c =================================================================== --- trunk/batctl/sys.c 2010-01-25 09:25:47 UTC (rev 1566) +++ trunk/batctl/sys.c 2010-01-26 03:21:47 UTC (rev 1567) @@ -68,7 +68,7 @@ if (argc > found_args) return read_file("", argv[found_args], read_opt); else - return read_file("", "/dev/stdin", read_opt); + return read_file("", "/proc/self/fd/0", read_opt); }
static void log_level_usage(void)