No empty .Rs/.Re
[netbsd-mini2440.git] / usr.bin / rcs / src / rcskeys.c
blobe367589d70cf0772ab054cbbbd08dcc867f5b14d
1 /*
2 * RCS keyword table and match operation
3 */
4 #ifndef lint
5 static char rcsid[]= "$Id: rcskeys.c,v 1.1 1993/03/21 09:58:08 cgd Exp $ Purdue CS";
6 #endif
8 /* Copyright (C) 1982, 1988, 1989 Walter Tichy
9 * All rights reserved.
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
16 * by Walter Tichy.
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
41 * relative to 4.1
43 * Revision 1.2 87/09/24 14:00:10 narten
44 * Sources now pass through lint (if you ignore printf/sprintf/fprintf
45 * warnings)
47 * Revision 1.1 84/01/23 14:50:32 kcs
48 * Initial revision
50 * Revision 4.1 83/05/04 10:06:53 wft
51 * Initial revision.
56 #include "rcsbase.h"
60 struct { char * keyword; enum markers marker;} markertable[] =
61 {{AUTHOR, Author },
62 {DATE, Date },
63 {HEADER, Header },
64 {IDH, Id },
65 {LOCKER, Locker },
66 {LOG, Log },
67 {RCSFILE, RCSfile },
68 {REVISION, Revision},
69 {SOURCE, Source },
70 {STATE, State },
71 {nil, Nomatch }};
75 enum markers trymatch(string,onlyvdelim)
76 char * string;
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.
83 register int j;
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) {
89 p++; s++;
91 if (*p != '\0') continue; /* no match */
92 if ((*s == VDELIM) || (!onlyvdelim && (*s == KDELIM)))
93 return(markertable[j].marker);
95 return(Nomatch);