diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2008-12-15 03:13:01 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2008-12-15 03:13:01 +0000 |
commit | 92941d9a204a13e8a7ffd43cc025199c04152f6e (patch) | |
tree | 5b40d38e5c3457bc8ed4b4d7628640a7cbb7d9af /strings.c | |
parent | 6b19efa3cb0a1a3c2f1008f516fb66e64458724f (diff) | |
download | mandoc-92941d9a204a13e8a7ffd43cc025199c04152f6e.tar.gz |
*** empty log message ***
Diffstat (limited to 'strings.c')
-rw-r--r-- | strings.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/strings.c b/strings.c new file mode 100644 index 00000000..786ae88b --- /dev/null +++ b/strings.c @@ -0,0 +1,66 @@ +/* $Id$ */ +/* + * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +#include <assert.h> +#include <ctype.h> +#include <stdlib.h> +#include <stdio.h> + +#include "private.h" + +int +mdoc_isdelim(const char *p) +{ + + if (0 == *p) + return(0); + if (0 != *(p + 1)) + return(0); + + switch (*p) { + case('{'): + /* FALLTHROUGH */ + case('.'): + /* FALLTHROUGH */ + case(','): + /* FALLTHROUGH */ + case(';'): + /* FALLTHROUGH */ + case(':'): + /* FALLTHROUGH */ + case('?'): + /* FALLTHROUGH */ + case('!'): + /* FALLTHROUGH */ + case('('): + /* FALLTHROUGH */ + case(')'): + /* FALLTHROUGH */ + case('['): + /* FALLTHROUGH */ + case(']'): + /* FALLTHROUGH */ + case('}'): + return(1); + default: + break; + } + + return(0); +} + |