From owner-freebsd-hackers@FreeBSD.ORG Mon May 2 13:26:48 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 15F9F106566B for ; Mon, 2 May 2011 13:26:48 +0000 (UTC) (envelope-from rs@bytecamp.net) Received: from mail.bytecamp.net (mail.bytecamp.net [212.204.60.9]) by mx1.freebsd.org (Postfix) with ESMTP id 4E87E8FC08 for ; Mon, 2 May 2011 13:26:46 +0000 (UTC) Received: (qmail 46461 invoked by uid 89); 2 May 2011 15:00:06 +0200 Received: from stella.bytecamp.net (HELO ?212.204.60.37?) (rs%bytecamp.net@212.204.60.37) by mail.bytecamp.net with CAMELLIA256-SHA encrypted SMTP; 2 May 2011 15:00:06 +0200 Message-ID: <4DBEAAD5.7040906@bytecamp.net> Date: Mon, 02 May 2011 15:00:05 +0200 From: Robert Schulze Organization: bytecamp GmbH User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit 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 13:26:48 -0000 Hi, Am 02.05.2011 14:13, schrieb Martin Möller: > > Criteria: > o Receive the value of > o Check the Environment: Is really sourrounded by 'GET ' and > 'HTTP/1.1' ?! these quite simple criteria might be matched by code like this one: char *ptr=NULL; char *res=NULL; if(strstr(str,"GET ")==str) /* "GET " at beginning? */ { ptr=(str+4); if(ptr && (ptr=strstr(ptr," HTTP/1.1"))) /* find end of res */ { *ptr=0; /* temp delimiter */ res=strdup(ptr); *ptr=' '; /* restore original value of str */ } } res is the value of , or NULL. with kind regards, Robert Schulze