int at_parse_cops_list(const char* s, modem_oper_t** opers) { regmatch_t *pmatch; modem_oper_t* oper; size_t nmatch; int nopers; nopers = 0; *opers = NULL; while(*s) { if(re_parse(s, "\\(([0123]),\"(.{0,16})\",\"(.{0,16})\",\"([0-9]{5,16})\",([012])),?", &nmatch, &pmatch)) break; /* increase memory for result */ *opers = realloc(*opers, sizeof(modem_oper_t) * (nopers + 1)); oper = (*opers + nopers); /* add new info about operator */ oper->stat = re_atoi(s, pmatch + 1); re_strncpy(oper->longname, sizeof(oper->longname), s, pmatch + 2); re_strncpy(oper->shortname, sizeof(oper->shortname), s, pmatch + 3); re_strncpy(oper->numeric, sizeof(oper->numeric), s, pmatch + 4); oper->act = re_atoi(s, pmatch + 5); ++ nopers; /* next operator to parse */ s += re_strlen(pmatch); free(pmatch); } return(nopers); }
charT* BOOST_REGEX_CALL re_strdup(const charT* p) { charT* buf = new charT[re_strlen(p) + 1]; re_strcpy(buf, p); return buf; }