1/* RCS keyword table and match operation */
2
3/* Copyright 1982, 1988, 1989 Walter Tichy
4 Copyright 1990, 1991, 1992, 1993, 1995 Paul Eggert
5 Distributed under license by the Free Software Foundation, Inc.
6
7This file is part of RCS.
8
--- 15 unchanged lines hidden (view full) ---
24Report problems and direct all questions to:
25
26 rcs-bugs@cs.purdue.edu
27
28*/
29
30/*
31 * $Log: rcskeys.c,v $
32 * Revision 5.4 1995/06/16 06:19:24 eggert
33 * Update FSF address.
34 *
35 * Revision 5.3 1993/11/03 17:42:27 eggert
36 * Add Name keyword.
37 *
38 * Revision 5.2 1991/08/19 03:13:55 eggert
39 * Say `T const' instead of `const T'; it's less confusing for pointer types.
--- 19 unchanged lines hidden (view full) ---
59 * Revision 4.1 83/05/04 10:06:53 wft
60 * Initial revision.
61 *
62 */
63
64
65#include "rcsbase.h"
66
67libId(keysId, "$Id: rcskeys.c,v 5.4 1995/06/16 06:19:24 eggert Exp $")
68
69
70char const *const Keyword[] = {
71 /* This must be in the same order as rcsbase.h's enum markers type. */
72 0,
73 AUTHOR, DATE, HEADER, IDH,
74 LOCKER, LOG, NAME, RCSFILE, REVISION, SOURCE, STATE
75};
76
77
78
79 enum markers
80trymatch(string)
81 char const *string;
82/* function: Checks whether string starts with a keyword followed
83 * by a KDELIM or a VDELIM.
84 * If successful, returns the appropriate marker, otherwise Nomatch.
85 */
86{
87 register int j;
88 register char const *p, *s;
89 for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) {
90 /* try next keyword */
91 p = Keyword[j];
92 s = string;
93 while (*p++ == *s++) {
94 if (!*p)
95 switch (*s) {
96 case KDELIM:
97 case VDELIM:
98 return (enum markers)j;
99 default:
100 return Nomatch;
101 }
102 }
103 }
104 return(Nomatch);
105}
106
2
3/* Copyright 1982, 1988, 1989 Walter Tichy
4 Copyright 1990, 1991, 1992, 1993, 1995 Paul Eggert
5 Distributed under license by the Free Software Foundation, Inc.
6
7This file is part of RCS.
8
--- 15 unchanged lines hidden (view full) ---
24Report problems and direct all questions to:
25
26 rcs-bugs@cs.purdue.edu
27
28*/
29
30/*
31 * $Log: rcskeys.c,v $
32 * Revision 5.4 1995/06/16 06:19:24 eggert
33 * Update FSF address.
34 *
35 * Revision 5.3 1993/11/03 17:42:27 eggert
36 * Add Name keyword.
37 *
38 * Revision 5.2 1991/08/19 03:13:55 eggert
39 * Say `T const' instead of `const T'; it's less confusing for pointer types.
--- 19 unchanged lines hidden (view full) ---
59 * Revision 4.1 83/05/04 10:06:53 wft
60 * Initial revision.
61 *
62 */
63
64
65#include "rcsbase.h"
66
67libId(keysId, "$Id: rcskeys.c,v 5.4 1995/06/16 06:19:24 eggert Exp $")
68
69
70char const *const Keyword[] = {
71 /* This must be in the same order as rcsbase.h's enum markers type. */
72 0,
73 AUTHOR, DATE, HEADER, IDH,
74 LOCKER, LOG, NAME, RCSFILE, REVISION, SOURCE, STATE
75};
76
77
78
79 enum markers
80trymatch(string)
81 char const *string;
82/* function: Checks whether string starts with a keyword followed
83 * by a KDELIM or a VDELIM.
84 * If successful, returns the appropriate marker, otherwise Nomatch.
85 */
86{
87 register int j;
88 register char const *p, *s;
89 for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) {
90 /* try next keyword */
91 p = Keyword[j];
92 s = string;
93 while (*p++ == *s++) {
94 if (!*p)
95 switch (*s) {
96 case KDELIM:
97 case VDELIM:
98 return (enum markers)j;
99 default:
100 return Nomatch;
101 }
102 }
103 }
104 return(Nomatch);
105}
106