Date: Mon, 02 May 2011 15:00:05 +0200 From: Robert Schulze <rs@bytecamp.net> To: freebsd-hackers@freebsd.org Subject: Re: [LIBC] Modfied Version of sscanf Message-ID: <4DBEAAD5.7040906@bytecamp.net> In-Reply-To: <C9E46C77.389%moeller.akt@googlemail.com> References: <C9E46C77.389%moeller.akt@googlemail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, Am 02.05.2011 14:13, schrieb Martin Möller: > > Criteria: > o Receive the value of<resource> > o Check the Environment: Is<resource> 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 <resource>, or NULL. with kind regards, Robert Schulze
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DBEAAD5.7040906>