On Tue, Dec 13, 2011 at 07:54:14PM -0500, Greg Smith wrote:
> After this bit of tinkering with the code, it feels to me like this
> really wants a split() function to break out the two sides of a
> string across a delimiter, eating it in the process. Adding the
> level of paranoia I'd like around every bit of code I see that does
> that type of operation right now would take a while. Refactoring in
> terms of split and perhaps a few similarly higher-level string
> parsing operations, targeted for this job, might make it easier to
> focus on fortifying those library routines instead. For example,
> instead of the gunk I just added that moves past either type of
> protocol prefix, I'd like to just say "split(buf,"://",&left,&right)
> and then move on with processing the right side.
FWIW, python calls this operation "partition", as in:
left, delim, right = buf.partition("://")
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts. -- Arthur Schopenhauer