Regular expressions, C++ kai linux
Άγγελος Οικονομόπουλος
aoiko at cc.ece.ntua.gr
Tue Jun 25 17:48:02 EEST 2002
On Tuesday 25 June 2002 15:07, Dimitris Stasinopoulos wrote:
>
> char * cc_strstr_nocase(char * haystack, char * needle)
> {
> regex_t preg;
> regmatch_t pmatch;
> int err_no=0;
> int offset=0;
pragmatika xrhsimopoeis 0 indentation ?
echo "Dimitris Stasinopoulos" >> ~/list_of_people_to_kill
>
> if(haystack==NULL)
> return NULL;
>
> if(needle==NULL)
> return haystack;
>
> err_no=regcomp(&preg, needle, REG_ICASE);
> if(err_no)
> return NULL;
>
> err_no=regexec(&preg, haystack, 1, &pmatch, 0);
> if(err_no)
> {
> regfree(&preg);
> return NULL;
> }
>
> offset=pmatch.rm_so;
> regfree(&preg);
> return haystack+offset;
> }
--
indent does _not_ solve the problem of:
* buggers who add 1001st broken implementation of memcmp(), call it
FooTurdCompare and prepend it with 20x80 block comment.
- Alexander Viro on coding style
More information about the Linux-greek-users
mailing list