]>
git.cameronkatri.com Git - mandoc.git/blob - mdoc_strings.c
1 /* $Id: mdoc_strings.c,v 1.25 2011/03/17 01:23:29 kristaps Exp $ */
3 * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 #include <sys/types.h>
32 static const char * const secnames
[SEC__MAX
] = {
38 "IMPLEMENTATION NOTES",
53 "SECURITY CONSIDERATIONS",
58 mdoc_isdelim(const char *p
)
93 * XXX; account for groff bubu where the \*(Ba reserved string
94 * is treated in exactly the same way as the vertical bar. This
95 * is the only function that checks for this.
97 return(strcmp(p
, "\\*(Ba") ? DELIM_NONE
: DELIM_MIDDLE
);
102 mdoc_str2sec(const char *p
)
106 for (i
= 0; i
< (int)SEC__MAX
; i
++)
107 if (secnames
[i
] && 0 == strcmp(p
, secnames
[i
]))
108 return((enum mdoc_sec
)i
);
114 /* FIXME: move this into an editable .in file. */
116 mdoc_macro2len(enum mdoct macro
)