parser_f.c

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * parser helper  functions
00005  *
00006  *
00007  * Copyright (C) 2001-2003 FhG Fokus
00008  *
00009  * This file is part of ser, a free SIP server.
00010  *
00011  * ser is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version
00015  *
00016  * For a license to use the ser software under conditions
00017  * other than those described here, or to purchase support for this
00018  * software, please contact iptel.org by e-mail at the following addresses:
00019  *    info@iptel.org
00020  *
00021  * ser is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  * GNU General Public License for more details.
00025  *
00026  * You should have received a copy of the GNU General Public License 
00027  * along with this program; if not, write to the Free Software 
00028  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00029  *
00030  * History:
00031  * ---------
00032  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
00033  */
00034 
00042 #include  "parser_f.h"
00043 #include "../ut.h"
00044 
00046 char* eat_line(char* buffer, unsigned int len)
00047 {
00048         char* nl;
00049 
00050         /* jku .. replace for search with a library function; not conforming
00051                   as I do not care about CR
00052         */
00053         nl=(char *)q_memchr( buffer, '\n', len );
00054         if ( nl ) { 
00055                 if ( nl + 1 < buffer+len)  nl++;
00056                 if (( nl+1<buffer+len) && * nl=='\r')  nl++;
00057         } else  nl=buffer+len;
00058         return nl;
00059 }
00060