2 ** seq_nameok.c -- check if a name is ok for a user-defined sequence
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
13 ** returns true if it is a valid name for a user-defined sequence
16 seq_nameok(unsigned char *s)
20 if (s == NULL || *s == '\0') {
21 advise(NULL, "empty sequence name");
26 ** Make sure sequence name doesn't clash with one
27 ** of the `reserved' sequence names.
28 ** Note: Accept `cur' here! But why is it treated special? --meillo
30 if (strcmp(s, seq_first)==0 || strcmp(s, seq_last)==0 ||
31 strcmp(s, seq_prev)==0 || strcmp(s, seq_next)==0 ||
32 strcmp(s, seq_all)==0 || strcmp(s, seq_beyond)==0) {
33 advise(NULL, "collision with reserved sequence name: `%s'", s);
38 ** First character in a sequence name must be
39 ** an alphabetic character ...
42 advise(NULL, "sequence name must start with a letter: %s", s);
47 ** and can be followed by zero or more alphanumeric characters
49 for (pp = s+1; *pp; pp++) {
51 advise(NULL, "sequence name must only contain "
52 "letters and digits: %s", s);