On 1/23/19 9:43 AM, Bill Fenner wrote:
The pattern I was trying to follow from the existing code appeared to be basically

if (cp == delimiter of optional section) {
     *cp = '\0'; /* terminate previous section at delimiter */
     this = cp + 1; /* handle this section */
     cp = ... /* find next optional delimiter or NULL */
}

Are you suggesting instead to put the "find next optional delimiter" code between sections, e.g.,

/* parse IP address, cp still points at beginning of address */
maybeintf = strchr( cp, '@' );
if (maybeintf) {
    *maybeintf = '\0';
    cp = maybeintf + 1;
    intf = cp;
}
maybens = strchr( cp, '@' );
if (maybens) {
...
}
maybeport = strchr( cp, ':' );
if (maybeport) {
...
}

Hi Bill,

No matter which approach will be chosen, please add test cases into testing/fulltests/unit-tests/T022netsnmp_parse_ep_str_clib.c.

Thanks,

Bart.


_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to