]>
git.cameronkatri.com Git - mandoc.git/blob - mdoc_strings.c
1 /* $Id: mdoc_strings.c,v 1.24 2010/07/31 23:52:58 schwarze 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 * FIXME: this is repeated in print_text() (html.c) and term_word()
97 mdoc_isdelim(const char *p
)
103 return(mdoc_iscdelim(p
[0]));
106 * XXX; account for groff bubu where the \*(Ba reserved string
107 * is treated in exactly the same way as the vertical bar. This
108 * is the only function that checks for this.
110 return(strcmp(p
, "\\*(Ba") ? DELIM_NONE
: DELIM_MIDDLE
);
115 mdoc_str2sec(const char *p
)
119 for (i
= 0; i
< (int)SEC__MAX
; i
++)
120 if (secnames
[i
] && 0 == strcmp(p
, secnames
[i
]))
121 return((enum mdoc_sec
)i
);
127 /* FIXME: move this into an editable .in file. */
129 mdoc_macro2len(enum mdoct macro
)