diff options
-rw-r--r-- | parse-filter.c | 26 |
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 | ||
53 | static 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 | |||
53 | static void free_token(char *token) | 77 | static 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, |