On Wed, Jan 23, 2019 at 10:17 PM Bart Van Assche <bvanass...@acm.org> wrote:
> 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. There are several new test cases for namespace names in what’s on github now, and in a revision I haven’t pushed yet I added some corner cases like “hostname@@“ and “hostname@@:”. Was there anything else you thought was missing? (Thanks for having written that test, by the way; it helped me find a bug in my initial code.) Thanks, Bill
_______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders