aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/strings.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-12-15 03:13:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-12-15 03:13:01 +0000
commit6c3b37813f4c2bc4a7e1a49ffaf581369c41dea1 (patch)
tree6451d15053d6a7b51cf1b682c70c5e746adc75d4 /strings.c
parent01d736ab19ed51964051240736f923a56d8d16d6 (diff)
downloadmandoc-6c3b37813f4c2bc4a7e1a49ffaf581369c41dea1.tar.gz
mandoc-6c3b37813f4c2bc4a7e1a49ffaf581369c41dea1.tar.zst
mandoc-6c3b37813f4c2bc4a7e1a49ffaf581369c41dea1.zip
*** empty log message ***
Diffstat (limited to 'strings.c')
-rw-r--r--strings.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/strings.c b/strings.c
new file mode 100644
index 00000000..1380bf7d
--- /dev/null
+++ b/strings.c
@@ -0,0 +1,66 @@
+/* $Id: strings.c,v 1.1 2008/12/15 03:13:01 kristaps Exp $ */
+/*
+ * 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);
+}
+