2 * RCS keyword table and match operation
5 static char rcsid
[]= "$Id: rcskeys.c,v 1.1 1993/03/21 09:58:08 cgd Exp $ Purdue CS";
8 /* Copyright (C) 1982, 1988, 1989 Walter Tichy
11 * Redistribution and use in source and binary forms are permitted
12 * provided that the above copyright notice and this paragraph are
13 * duplicated in all such forms and that any documentation,
14 * advertising materials, and other materials related to such
15 * distribution and use acknowledge that the software was developed
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 * Report all problems and direct all questions to:
22 * rcs-bugs@cs.purdue.edu
35 /* $Log: rcskeys.c,v $
36 * Revision 4.3 89/05/01 15:13:02 narten
37 * changed copyright header to reflect current distribution rules
39 * Revision 4.2 87/10/18 10:36:33 narten
40 * Updating version numbers. Changes relative to 1.1 actuallyt
43 * Revision 1.2 87/09/24 14:00:10 narten
44 * Sources now pass through lint (if you ignore printf/sprintf/fprintf
47 * Revision 1.1 84/01/23 14:50:32 kcs
50 * Revision 4.1 83/05/04 10:06:53 wft
60 struct { char * keyword
; enum markers marker
;} markertable
[] =
75 enum markers
trymatch(string
,onlyvdelim
)
77 /* function: Checks whether string starts with a keyword followed
78 * by a KDELIM or a VDELIM. If onlyvdelim==true, only a VDELIM
79 * may follow the keyword.
80 * If successful, returns the appropriate marker, otherwise Nomatch.
84 register char * p
, * s
;
85 for (j
=0; markertable
[j
].keyword
!=nil
; j
++ ) {
86 /* try next keyword */
87 p
= markertable
[j
].keyword
; s
= string
;
88 while (*p
!='\0' && *s
!='\0' && *p
== *s
) {
91 if (*p
!= '\0') continue; /* no match */
92 if ((*s
== VDELIM
) || (!onlyvdelim
&& (*s
== KDELIM
)))
93 return(markertable
[j
].marker
);