Date: Mon, 2 May 2011 11:57:22 -0400 From: Arnaud Lacombe <lacombar@gmail.com> To: =?ISO-8859-1?Q?Martin_M=F6ller?= <moeller.akt@googlemail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: [LIBC] Modfied Version of sscanf Message-ID: <BANLkTinJVG=%2BUq5rc=FdS6WueQSJmDxuaA@mail.gmail.com> In-Reply-To: <C9E46C77.389%moeller.akt@googlemail.com> References: <20110501162925.GB47497@stack.nl> <C9E46C77.389%moeller.akt@googlemail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, On Mon, May 2, 2011 at 8:13 AM, Martin M=F6ller <moeller.akt@googlemail.com> wrote: > Hello, > > Thanks for all the replies. > We have so far discovered the following suggetions for the parsing Proble= m: > Using: > =A0 =A0o a tokenizer/parser is too much overhead for such a simple task > =A0 =A0o strchr, memchr is too low-level and not elegant enough > =A0 =A0o strtok would not even parse (tokenize) this simple example > =A0 =A0o a regexp library: How would you solve the problem with a regexp = lib ? > > Criteria: > =A0 =A0o Receive the value of <resource> > =A0 =A0o Check the Environment: Is <resource> really sourrounded by 'GET = ' and > =A0 =A0 =A0'HTTP/1.1' ?! > There is plenty of library out there dealing with parsing the code you pointed out. Do you really need to re-invent the wheel ? - Arnaud > I need a function which accepts BNF-style rules. > E.g.: > =A0 =A0char resource [512]; > > =A0 =A0ret =3D 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 > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTinJVG=%2BUq5rc=FdS6WueQSJmDxuaA>