diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-08-16 13:11:44 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-08-16 13:11:44 -0500 |
commit | 54c75c47f8df356361a1ecab121d4516652f6dfe (patch) | |
tree | 413be7145ad00fe60f2b513e61c288f507a485db /gatchat/gatchat.c | |
parent | 5681e9df4989cf692512cddbf17378bb2d5adfce (diff) | |
download | ofono-54c75c47f8df356361a1ecab121d4516652f6dfe.tar.bz2 |
gatchat: Skip string contents in extract_line
Diffstat (limited to 'gatchat/gatchat.c')
-rw-r--r-- | gatchat/gatchat.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c index 8f060eeb..e85d9086 100644 --- a/gatchat/gatchat.c +++ b/gatchat/gatchat.c @@ -592,18 +592,23 @@ static char *extract_line(struct at_chat *p, struct ring_buffer *rbuf) unsigned int wrap = ring_buffer_len_no_wrap(rbuf); unsigned int pos = 0; unsigned char *buf = ring_buffer_read_ptr(rbuf, pos); + gboolean in_string = FALSE; int strip_front = 0; int line_length = 0; char *line; while (pos < p->read_so_far) { - if (*buf == '\r' || *buf == '\n') + if (in_string == FALSE && (*buf == '\r' || *buf == '\n')) { if (!line_length) strip_front += 1; else break; - else + } else { + if (*buf == '"') + in_string = !in_string; + line_length += 1; + } buf += 1; pos += 1; |