gpiomon: fix parsing of custom output formats
authorBartosz Golaszewski <bartekgola@gmail.com>
Tue, 20 Jun 2017 18:03:33 +0000 (20:03 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Tue, 20 Jun 2017 18:03:33 +0000 (20:03 +0200)
The '%%e' string should be printed as '%e' - the same as for printf()
format specifiers - but gpiomon prints '%%e' in this case. Fix it.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
src/tools/gpiomon.c

index b54ee2ba9bb22a0bb50b8ca560e507a77a849e24..10b07d9a3440413c8332c72e356db812b9f17f05 100644 (file)
@@ -123,7 +123,8 @@ static void event_print_custom(int type, const struct timespec *ts,
                off = pos - str;
 
                if (fmt == '%') {
-                       off += 2;
+                       memmove(str + off, str + off + 1, strlen(str) - off);
+                       off += 1;
                        continue;
                }