aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-16 09:44:01 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-16 09:44:01 -0500
commit4d477302e1fc73d50e462fdc9e67a2ded9e38885 (patch)
treee62e3b7860d840aa20f53500c5a7b305b5957a84
parente6dc364b1d6530bcc30de99e73e39e6e3d45361d (diff)
parse-events: Add strim() to allow whitespace in filter event names
Adde strim() to remove leading and trailing whitespace from the event and system names being passed into the filter. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-filter.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/parse-filter.c b/parse-filter.c
index 15b3d16..aab642c 100644
--- a/parse-filter.c
+++ b/parse-filter.c
@@ -50,6 +50,30 @@ static void show_error(char **error_str, const char *fmt, ...)
50 va_end(ap); 50 va_end(ap);
51} 51}
52 52
53static char *strim(char *string)
54{
55 char *ret;
56
57 if (!string)
58 return NULL;
59 while (*string) {
60 if (!isspace(*string))
61 break;
62 string++;
63 }
64 ret = string;
65
66 string = ret + strlen(ret) - 1;
67 while (string > ret) {
68 if (!isspace(*string))
69 break;
70 string--;
71 }
72 string[1] = 0;
73
74 return ret;
75}
76
53static void free_token(char *token) 77static void free_token(char *token)
54{ 78{
55 pevent_free_token(token); 79 pevent_free_token(token);
@@ -704,7 +728,7 @@ int pevent_filter_add_filter_str(struct event_filter *filter,
704 } 728 }
705 729
706 /* Find this event */ 730 /* Find this event */
707 ret = find_event(pevent, &events, sys_name, event_name); 731 ret = find_event(pevent, &events, strim(sys_name), strim(event_name));
708 if (ret < 0) { 732 if (ret < 0) {
709 if (event_name) 733 if (event_name)
710 show_error(error_str, 734 show_error(error_str,