From owner-freebsd-hackers@FreeBSD.ORG Mon May 2 12:13:17 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 6CFCF1065670 for ; Mon, 2 May 2011 12:13:17 +0000 (UTC) (envelope-from moeller.akt@googlemail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id E80288FC1E for ; Mon, 2 May 2011 12:13:16 +0000 (UTC) Received: by bwz12 with SMTP id 12so6557672bwz.13 for ; Mon, 02 May 2011 05:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:user-agent:date:subject:from:to:message-id :thread-topic:thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=0Auw7M90IpWMifz5cqU+LWjUzGYiimptkCd385osAO4=; b=LxGB1RxnExVJaw//2PMZN3dZtHXG8vNGJ2vNeqPUDBtn6yIzwb2pGcMhKUSNCNJFra RiazbkJVkz12vDcTKCtgg1qCUYCsmBuiSosHZRCywwxSvfo1cv5YMF9oWBEiv4YP1Jdl Hcsc8GcBbkFIqwEqbGwWexgK012PWIW24WUiM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=uVYT72339j2h3F2IIRzVhZ1SjaH4kir1ATdWfA8Y0oyk0cjl+qNLB0E1zD8T10va9+ 4i1CMCYnZjEMdmQBF98a/poFSA+Mr0CjgHzNFPpyAVVotQMpwtzKDaeBax93ZUlBYjOd TlmqRhfRCoCrgldu3xcS2k/wJ+oja3dnBJI/U= Received: by 10.204.229.193 with SMTP id jj1mr2462340bkb.21.1304338395585; Mon, 02 May 2011 05:13:15 -0700 (PDT) Received: from [192.168.0.108] (p5B24CEC4.dip.t-dialin.net [91.36.206.196]) by mx.google.com with ESMTPS id c11sm3259217bkc.14.2011.05.02.05.13.13 (version=SSLv3 cipher=OTHER); Mon, 02 May 2011 05:13:14 -0700 (PDT) User-Agent: Microsoft-Entourage/12.0.0.071130 Date: Mon, 02 May 2011 14:13:11 +0200 From: Martin =?ISO-8859-1?B?TfZsbGVy?= To: Message-ID: Thread-Topic: [LIBC] Modfied Version of sscanf Thread-Index: AcwIwk3eMnnzSYUUSLGl9Lolund+ag== In-Reply-To: <20110501162925.GB47497@stack.nl> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit 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 12:13:17 -0000 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 o Check the Environment: Is 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