summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-03-02 01:40:51 +0100
committerHarald Welte <laforge@gnumonks.org>2013-03-02 01:40:51 +0100
commitab81993da29009836f639ccf518dbd92d08364fb (patch)
treee96d14ecb64e0386cefe85ffed2a5465803c366f
parentdd46f418be6a5f7cfc7d0d1e60f83f73edcb7743 (diff)
gsmd: Support Operator Names with parenthesis in their long/short name
The previous parser caused parsing errors when recognizing parenthesis '()' inside a network operator name like "O2 (Germany) GmbH" We now keep track if we are inside a quote, and ignore parenthesis until the end of the quote mark.
-rw-r--r--src/gsmd/usock.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c
index 5e5b5c3..13c3bb1 100644
--- a/src/gsmd/usock.c
+++ b/src/gsmd/usock.c
@@ -961,6 +961,7 @@ static int network_oper_n_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
static int network_opers_parse(const char *str, struct gsmd_msg_oper **out)
{
int len = 0;
+ int in_quote = 0;
struct gsm_extrsp *er;
char buf[64];
char *head, *tail, *ptr;
@@ -995,9 +996,11 @@ static int network_opers_parse(const char *str, struct gsmd_msg_oper **out)
str = ptr;
while (*str) {
- if ( *str == '(' )
+ if (*str == '"')
+ in_quote = !in_quote;
+ if (!in_quote && *str == '(')
head = (char *) str;
- else if ( *str == ')' ) {
+ else if (!in_quote && *str == ')') {
tail = (char *) str;
memset(buf, '\0', sizeof(buf));
personal git repositories of Harald Welte. Your mileage may vary