Re: Library Design, f0dder's nightmare.



japheth wrote:
Nice, Hutch, but unless you provide a reliable source where we can get
this mysterious f0dder.lib and can make our own tests - if someone is
really that bored - your posting must be regarded as slander.

I spent the ~45 seconds it took to add TAB support to my tokenizer, it can
be found at http://f0dder.reteam.org/misc/cmdline_parse_2.zip . I dunno why
anybody would use tab delimiting for commandlines, but here it is.

The snippet is useful for constructing a C-style argv[] array, without
modifying the OS-supplied commandline, and only allocating as much memory as
is really needed. It doesn't have a limitation on the length of the
commandline (or whatever you're tokenizing with it), nor on the length of
each individual argument.

It does, however, use the stack for storing {offset,length} pairs while
parsing the string, so there's a limit to the maximum number of tokens it
can handle. A win32 executable with default stack options can handle ~130k
arguments without a crash, so it should be "quite sufficient" for parsing
commandlines. A boundscheck would be trivial to add, if desired.


.