[LIBC] Modfied Version of sscanf

Martin Möller moeller.akt at googlemail.com
Mon May 2 12:13:17 UTC 2011


Hello,

Thanks for all the replies.
We have so far discovered the following suggetions for the parsing Problem:
Using: 
    o a tokenizer/parser is too much overhead for such a simple task
    o strchr, memchr is too low-level and not elegant enough
    o strtok would not even parse (tokenize) this simple example
    o a regexp library: How would you solve the problem with a regexp lib ?

Criteria:
    o Receive the value of <resource>
    o Check the Environment: Is <resource> really sourrounded by 'GET ' and
      'HTTP/1.1' ?!

I need a function which accepts BNF-style rules.
E.g.:
    char resource [512];

    ret = bnfparse (request, "GET %s HTTP/1.1", resource);

Ret would be $(NUMBER OF FORMAT SPECIFIERS, successfully handled) +env.
Env would be 1 if the Environment passes, and 0 is not.

Any comments ?
Best regards,
Martin




More information about the freebsd-hackers mailing list