modem-helpers: allow unquoted strings in +CCLK responses

Also:
  * define the leading '+' as a escaped value
  * allow any number of spaces between '+CCLK' and the string value.
This commit is contained in:
Aleksander Morgado
2017-08-09 12:02:36 +02:00
parent 9528450684
commit dec53d6ef6
2 changed files with 26 additions and 2 deletions

View File

@@ -4157,8 +4157,11 @@ mm_parse_cclk_response (const char *response,
g_assert (iso8601p || tzp); /* at least one */
/* Sample reply: +CCLK: "15/03/05,14:14:26-32" */
r = g_regex_new ("[+]CCLK: \"(\\d+)/(\\d+)/(\\d+),(\\d+):(\\d+):(\\d+)([-+]\\d+)?\"", 0, 0, NULL);
/* Sample replies:
* +CCLK: "15/03/05,14:14:26-32"
* +CCLK: 17/07/26,11:42:15+01
*/
r = g_regex_new ("\\+CCLK:\\s*\"?(\\d+)/(\\d+)/(\\d+),(\\d+):(\\d+):(\\d+)([-+]\\d+)?\"?", 0, 0, NULL);
g_assert (r != NULL);
if (!g_regex_match_full (r, response, -1, 0, 0, &match_info, &match_error)) {