parser_f.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * $Id$
  3. *
  4. * parser helper functions
  5. *
  6. *
  7. * Copyright (C) 2001-2003 Fhg Fokus
  8. *
  9. * This file is part of ser, a free SIP server.
  10. *
  11. * ser is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version
  15. *
  16. * For a license to use the ser software under conditions
  17. * other than those described here, or to purchase support for this
  18. * software, please contact iptel.org by e-mail at the following addresses:
  19. * [email protected]
  20. *
  21. * ser is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29. */
  30. #include "parser_f.h"
  31. #include "../ut.h"
  32. /* returns pointer to next line or after the end of buffer */
  33. char* eat_line(char* buffer, unsigned int len)
  34. {
  35. char* nl;
  36. /* jku .. replace for search with a library function; not conformant
  37. as I do not care about CR
  38. */
  39. nl=(char *)q_memchr( buffer, '\n', len );
  40. if ( nl ) {
  41. if ( nl + 1 < buffer+len) nl++;
  42. if (( nl+1<buffer+len) && * nl=='\r') nl++;
  43. } else nl=buffer+len;
  44. return nl;
  45. }