Remove RCS keywords, since they no longer work after git migration.
[mmh] / sbr / seq_nameok.c
1
2 /*
3  * seq_nameok.c -- check if a sequence name is ok
4  *
5  * This code is Copyright (c) 2002, by the authors of nmh.  See the
6  * COPYRIGHT file in the root directory of the nmh distribution for
7  * complete copyright information.
8  */
9
10 #include <h/mh.h>
11
12
13 int
14 seq_nameok (unsigned char *s)
15 {
16     unsigned char *pp;
17
18     if (s == NULL || *s == '\0') {
19         advise (NULL, "empty sequence name");
20         return 0;
21     }
22
23     /*
24      * Make sure sequence name doesn't clash with one
25      * of the `reserved' sequence names.
26      */
27     if (!(strcmp (s, "new") &&
28           strcmp (s, "all") &&
29           strcmp (s, "first") &&
30           strcmp (s, "last") &&
31           strcmp (s, "prev") &&
32           strcmp (s, "next"))) {
33         advise (NULL, "illegal sequence name: %s", s);
34         return 0;
35     }
36
37     /*
38      * First character in a sequence name must be
39      * an alphabetic character ...
40      */
41     if (!isalpha (*s)) {
42         advise (NULL, "illegal sequence name: %s", s);
43         return 0;
44     }
45
46     /*
47      * and can be followed by zero or more alphanumeric characters
48      */
49     for (pp = s + 1; *pp; pp++)
50         if (!isalnum (*pp)) {
51             advise (NULL, "illegal sequence name: %s", s);
52             return 0;
53         }
54
55     return 1;
56 }