Author: marek Date: 2010-01-26 04:45:37 +0100 (Tue, 26 Jan 2010) New Revision: 1568
Modified: branches/batctl-0.2.x/functions.c branches/batctl-0.2.x/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: branches/batctl-0.2.x/functions.c =================================================================== --- branches/batctl-0.2.x/functions.c 2010-01-26 03:21:47 UTC (rev 1567) +++ branches/batctl-0.2.x/functions.c 2010-01-26 03:45:37 UTC (rev 1568) @@ -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: branches/batctl-0.2.x/sys.c =================================================================== --- branches/batctl-0.2.x/sys.c 2010-01-26 03:21:47 UTC (rev 1567) +++ branches/batctl-0.2.x/sys.c 2010-01-26 03:45:37 UTC (rev 1568) @@ -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)