From f7461be43e6f1fe21bedac3ba3b6a58c2e41fc6d Mon Sep 17 00:00:00 2001 From: kanoi Date: Sun, 28 Dec 2014 22:51:36 +1100 Subject: [PATCH] ckpmsg allow comments with a leading '#' and timestamp comments and empty lines --- src/ckpmsg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ckpmsg.c b/src/ckpmsg.c index 6f007df7..092a0121 100644 --- a/src/ckpmsg.c +++ b/src/ckpmsg.c @@ -104,13 +104,17 @@ int main(int argc, char **argv) LOGERR("Failed to get a valid line"); break; } + mkstamp(stamp, sizeof(stamp)); len = strlen(buf); if (len < 2) { - LOGERR("No message"); + LOGERR("%s No message", stamp); continue; } buf[len - 1] = '\0'; // Strip /n - mkstamp(stamp, sizeof(stamp)); + if (buf[0] == '#') { + LOGDEBUG("%s Got comment: %s", stamp, buf); + continue; + } LOGDEBUG("%s Got message: %s", stamp, buf); sockd = open_unix_client(socket_dir);