home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $Source: WB_2.1:homes/rkr/prog/sercli/src/RCS/config.c,v $
- ** $Author: rkr $
- ** $Revision: 1.5 $
- ** $Locker: rkr $
- ** $State: Exp $
- ** $Date: 1993/06/16 23:28:53 $
- **
- ** sercli (an Amiga .device <-> FIFO interface tool)
- ** Copyright (C) 1993 Richard Rauch
- **
- ** See /doc/sercli.doc and /COPYING for use and distribution license.
- **
- */
-
- #include "defs.h"
- #include "misc.h"
- #include "config.h"
-
-
-
- /*
- ** If the text is blank, or begins with one of certain characters, the
- ** text is considered a comment.
- **
- ** It might be better to provide these in a global string variable, or a
- ** parameter to this function, and use one of the ANSI searching functions
- ** to scan {comment_chars} for the first char in {text}.
- **
- **
- ** If the text is not deemed a comment, we locate the first colon in the
- ** line; this becomes a terminator for a compare.
- **
- ** Then, each option in {opts} is compared to text, up to, but not
- ** including, the colon. Case INsensitive
- **
- */
- int match (char *text, option *opts)
- {
- int
- end,
- result;
-
- switch (*text)
- {
- case 0:
- case ' ':
- case '\t':
- case '\n':
- case '\v':
- case '\r':
- case '*':
- case '#':
- case ';':
- case ':':
- result = OPTION_COMMENT;
- break;
-
- default:
- for (end = 0; (text [end]) && (text [end] != ':') ; ++end)
- ;
-
- for (; OPTION_NULL != opts->o_id; ++opts)
- if (strnicmp (text, opts->o_text, end) == 0)
- break;
-
- result = opts->o_id;
- if (!result)
- result = OPTION_NOT_FOUND;
-
- break;
- }
- return (result);
- }
-
-