X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fseq_nameok.c;h=e10ef92e75c38c2277e32d4a57d51697b9ba0d92;hp=6887ac6a309cce6a5e10792f1bfec0173c09418c;hb=a485ed478abbd599d8c9aab48934e7a26733ecb1;hpb=f480c03187724e54e5391ee61b810827da319a6c diff --git a/sbr/seq_nameok.c b/sbr/seq_nameok.c index 6887ac6..e10ef92 100644 --- a/sbr/seq_nameok.c +++ b/sbr/seq_nameok.c @@ -1,4 +1,3 @@ - /* * seq_nameok.c -- check if a sequence name is ok * @@ -13,44 +12,44 @@ int seq_nameok (unsigned char *s) { - unsigned char *pp; - - if (s == NULL || *s == '\0') { - advise (NULL, "empty sequence name"); - return 0; - } - - /* - * Make sure sequence name doesn't clash with one - * of the `reserved' sequence names. - */ - if (!(strcmp (s, "new") && - strcmp (s, "all") && - strcmp (s, "first") && - strcmp (s, "last") && - strcmp (s, "prev") && - strcmp (s, "next"))) { - advise (NULL, "illegal sequence name: %s", s); - return 0; - } - - /* - * First character in a sequence name must be - * an alphabetic character ... - */ - if (!isalpha (*s)) { - advise (NULL, "illegal sequence name: %s", s); - return 0; - } - - /* - * and can be followed by zero or more alphanumeric characters - */ - for (pp = s + 1; *pp; pp++) - if (!isalnum (*pp)) { - advise (NULL, "illegal sequence name: %s", s); - return 0; + unsigned char *pp; + + if (s == NULL || *s == '\0') { + advise (NULL, "empty sequence name"); + return 0; + } + + /* + * Make sure sequence name doesn't clash with one + * of the `reserved' sequence names. + */ + if (!(strcmp (s, "new") && + strcmp (s, "all") && + strcmp (s, "first") && + strcmp (s, "last") && + strcmp (s, "prev") && + strcmp (s, "next"))) { + advise (NULL, "illegal sequence name: %s", s); + return 0; } - return 1; + /* + * First character in a sequence name must be + * an alphabetic character ... + */ + if (!isalpha (*s)) { + advise (NULL, "illegal sequence name: %s", s); + return 0; + } + + /* + * and can be followed by zero or more alphanumeric characters + */ + for (pp = s + 1; *pp; pp++) + if (!isalnum (*pp)) { + advise (NULL, "illegal sequence name: %s", s); + return 0; + } + + return 1; }