parser_f.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. * History:
  31. * ---------
  32. * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  33. */
  34. /** @file
  35. * @brief Parser :: helper functions
  36. *
  37. * @ingroup parser
  38. */
  39. #include "parser_f.h"
  40. #include "../ut.h"
  41. /** @brief returns pointer to next line or after the end of buffer */
  42. char* eat_line(char* buffer, unsigned int len)
  43. {
  44. char* nl;
  45. /* jku .. replace for search with a library function; not conforming
  46. as I do not care about CR
  47. */
  48. nl=(char *)q_memchr( buffer, '\n', len );
  49. if ( nl ) {
  50. if ( nl + 1 < buffer+len) nl++;
  51. if (( nl+1<buffer+len) && * nl=='\r') nl++;
  52. } else nl=buffer+len;
  53. return nl;
  54. }