Skip to contentSkip to conversation

gatserver: Add ATS5 command feature

PATCH In review Olivier Guiter 2 participants 2 messages Feb 10, 2011 – Feb 14, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gatserver: Add ATS5 command feature

---
 gatchat/gatserver.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
gatchat/gatserver.c +6 -1
index be9f79a..25b7ba4 100644
@@ -796,6 +796,7 @@ static char *extract_line(GAtServer *p, struct ring_buffer *rbuf)
 	int line_length = 0;
 	gboolean in_string = FALSE;
 	char s3 = p->v250.s3;
+	char s5 = p->v250.s5;
 	char *line;
 	int i;
 
@@ -837,7 +838,11 @@ static char *extract_line(GAtServer *p, struct ring_buffer *rbuf)
 		if (*buf == '"')
 			in_string = !in_string;
 
-		if ((*buf == ' ' || *buf == '\t') && in_string == FALSE)
+		if (*buf == s5) {
+			if (i != 0)
+				i -= 1;
+		}
+		else if ((*buf == ' ' || *buf == '\t') && in_string == FALSE)
 			; /* Skip */
 		else if (*buf != s3)
 			line[i++] = *buf;
Signature · 1 line
1.7.1
#1 lore raw

Hi Olivier,

Quoted 4 lines · Olivier Guiter
---
 gatchat/gatserver.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

<snip>

gatchat/gatserver.c static char *extract_line(GAtServer *p, struct ring_buffer *rbuf) · line 845

Quoted 10 lines
gatchat/gatserver.c +5 -1
@@ -837,7 +838,11 @@ static char *extract_line(GAtServer *p, struct ring_buffer *rbuf)
 		if (*buf == '"')
 			in_string = !in_string;
 
-		if ((*buf == ' ' || *buf == '\t') && in_string == FALSE)
+		if (*buf == s5) {
+			if (i != 0)
+				i -= 1;
+		}
+		else if ((*buf == ' ' || *buf == '\t') && in_string == FALSE)

Please note that we follow the Linux kernel coding style, and in fact the closing brace should be on the same line as the else if. See CodingStyle document in the linux kernel git for more details.

I've fixed this for you. Patch has been applied, thanks.

Regards,
-Denis