From owner-freebsd-hackers@FreeBSD.ORG Mon May 2 15:57:23 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91627106566B for ; Mon, 2 May 2011 15:57:23 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 585658FC0A for ; Mon, 2 May 2011 15:57:23 +0000 (UTC) Received: by iwn33 with SMTP id 33so6655048iwn.13 for ; Mon, 02 May 2011 08:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=zLfERyDm1KRY1ci1mrWRZCHVNe/PvBz6qEUXHvHyYQ0=; b=XBKNRhX3iXsn21/HvKFY4iLjwEHMPZzuVX7VuP9eBv5C6AsQGBILXA/8rCKI63bPcS +oBnk+vhiglO1I2c7WLlOdNaDoZj0YXYVbVzTTsu9U0IwfiJvHWsk8dDk4lrde+Ye5QI 4g7rV3HAwGAGQAkHDH8f8fSs3a2Eo0oC3fMi0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=gFRzNTwy4sifCuBY4cN9CSHGf9+3y5edEJk+pRObRY1Q5r8zQV4Go5oF9u7TCTL+PO unt5gTaEOPvvMOAtVpZMIyg1J7+xpUYbYJZWbwCd0/WBLWKNbLNchpVJaRSZz88utTAo tW2SlFi29zMHy9S29BDyGOsGWnshjlhHPUmQQ= MIME-Version: 1.0 Received: by 10.43.44.6 with SMTP id ue6mr10479316icb.69.1304351842684; Mon, 02 May 2011 08:57:22 -0700 (PDT) Received: by 10.42.165.132 with HTTP; Mon, 2 May 2011 08:57:22 -0700 (PDT) In-Reply-To: References: <20110501162925.GB47497@stack.nl> Date: Mon, 2 May 2011 11:57:22 -0400 Message-ID: From: Arnaud Lacombe To: =?ISO-8859-1?Q?Martin_M=F6ller?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: [LIBC] Modfied Version of sscanf X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2011 15:57:23 -0000 Hi, On Mon, May 2, 2011 at 8:13 AM, Martin M=F6ller 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 > =A0 =A0o Check the Environment: Is 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= " >