summaryrefslogtreecommitdiffstats
path: root/gatchat/gatserver.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-03-30 14:36:02 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-03-30 14:36:02 -0500
commit0448392a911fd7b12ae5d45d650c67948da738f5 (patch)
treea13cf9818de107258b5d0d2dcfcc0fe0577ddb61 /gatchat/gatserver.c
parent882b62b640b35d8dc91f62a26cea26540c16fe0c (diff)
downloadofono-0448392a911fd7b12ae5d45d650c67948da738f5.tar.bz2
Refactor: Simplify extended command parsing logic
Diffstat (limited to 'gatchat/gatserver.c')
-rw-r--r--gatchat/gatserver.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index d01895d3..d90eeb56 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -280,7 +280,6 @@ static unsigned int parse_extended_command(GAtServer *server, char *buf)
const char *separators = ";?=";
unsigned int prefix_len, i;
gboolean in_string = FALSE;
- gboolean seen_question = FALSE;
gboolean seen_equals = FALSE;
char prefix[18]; /* According to V250, 5.4.1 */
GAtServerRequestType type;
@@ -322,24 +321,22 @@ static unsigned int parse_extended_command(GAtServer *server, char *buf)
goto next;
if (buf[i] == '?') {
- if (seen_question || seen_equals)
+ if (seen_equals && buf[i-1] != '=')
return 0;
if (buf[i + 1] != '\0' && buf[i + 1] != ';')
return 0;
- seen_question = TRUE;
type = G_AT_SERVER_REQUEST_TYPE_QUERY;
+
+ if (seen_equals)
+ type = G_AT_SERVER_REQUEST_TYPE_SUPPORT;
} else if (buf[i] == '=') {
- if (seen_equals || seen_question)
+ if (seen_equals)
return 0;
seen_equals = TRUE;
-
- if (buf[i + 1] == '?')
- type = G_AT_SERVER_REQUEST_TYPE_SUPPORT;
- else
- type = G_AT_SERVER_REQUEST_TYPE_SET;
+ type = G_AT_SERVER_REQUEST_TYPE_SET;
}
next: