const char rcsid_parse_c[] = "$Id: parse.c,v 1.1.1.1 2002/09/04 20:48:53 dtype Exp $"; /* * Copyright (c) 1996, Marc Horowitz. All rights reserved. * See the LICENSE file in the release for redistribution information. */ #include #include "util.h" #include "parse.h" /* the return value is the number of characters in string up to and not including the char */ long scan_char(unsigned char *input, long len, long *offset, unsigned char ch, long *str, long *str_len) { int i; if (*offset == len) { *str = -1; *str_len = 0; return(0); } for (i=*offset; i=0)?*line:*offset; while ((cnt > 0) && (input[tmp+cnt-1] == '\015')) cnt--; return(cnt); } int is_token(const unsigned char *str, long strlen, const char *token, long toklen, int exact) { if (strlen < toklen) return(0); if (exact && (strlen != toklen)) return(0); return(my_strncasecmp((char *) str, (char *) token, (int) toklen) == 0); }