]>
git.cameronkatri.com Git - mandoc.git/blob - mdoc_strings.c
1 /* $Id: mdoc_strings.c,v 1.20 2010/05/15 08:54:04 schwarze Exp $ */
3 * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
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>
31 static const char * const secnames
[SEC__MAX
] = {
37 "IMPLEMENTATION NOTES",
52 "SECURITY CONSIDERATIONS",
57 * FIXME: this is repeated in print_text() (html.c) and term_word()
96 mdoc_isdelim(const char *p
)
102 return(mdoc_iscdelim(p
[0]));
105 * XXX; account for groff bubu where the \*(Ba reserved string
106 * is treated in exactly the same way as the vertical bar. This
107 * is the only function that checks for this.
109 return(strcmp(p
, "\\*(Ba") ? DELIM_NONE
: DELIM_MIDDLE
);
114 mdoc_str2sec(const char *p
)
118 for (i
= 0; i
< (int)SEC__MAX
; i
++)
119 if (secnames
[i
] && 0 == strcmp(p
, secnames
[i
]))
120 return((enum mdoc_sec
)i
);
126 /* FIXME: move this into an editable .in file. */
128 mdoc_macro2len(enum mdoct macro
)