aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-06-17 17:13:53 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-06-17 17:13:53 -0400
commit0f15820a184a5b54541dd0e19fd6f1f807a846b4 (patch)
tree9e269a78f46e2162a0b784488b6bb2b60ead6146
parent11c82fa61b369684e8d4761c82712d8c7de978b7 (diff)
parse-events: Concatinate two strings that are adjacent
When two or more strings are adjacent ("string1" "string2") concatenate them into one string token. ("string1string2") Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/parse-events.c b/parse-events.c
index 082fe3b..d95dda4 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -834,6 +834,7 @@ static enum event_type __read_token(char **tok)
834 i--; 834 i--;
835 quote_ch = ch; 835 quote_ch = ch;
836 last_ch = 0; 836 last_ch = 0;
837 concat:
837 do { 838 do {
838 if (i == (BUFSIZ - 1)) { 839 if (i == (BUFSIZ - 1)) {
839 buf[i] = 0; 840 buf[i] = 0;
@@ -859,6 +860,22 @@ static enum event_type __read_token(char **tok)
859 } while (ch != quote_ch || last_ch == '\\'); 860 } while (ch != quote_ch || last_ch == '\\');
860 /* remove the last quote */ 861 /* remove the last quote */
861 i--; 862 i--;
863
864 /*
865 * For strings (double quotes) check the next token.
866 * If it is another string, concatinate the two.
867 */
868 if (type == EVENT_DQUOTE) {
869 unsigned long long save_input_buf_ptr = input_buf_ptr;
870
871 do {
872 ch = __read_char();
873 } while (isspace(ch));
874 if (ch == '"')
875 goto concat;
876 input_buf_ptr = save_input_buf_ptr;
877 }
878
862 goto out; 879 goto out;
863 880
864 case EVENT_ERROR ... EVENT_SPACE: 881 case EVENT_ERROR ... EVENT_SPACE: