1 /* $Vendor-Id: mdoc_strings.c,v 1.13 2009/11/02 06:22:46 kristaps 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.
17 #include <sys/types.h>
27 /* FIXME: this file is poorly named. */
30 const char *name
; /* Name of section. */
31 enum mdoc_sec sec
; /* Corresponding section. */
34 #define SECNAME_MAX (20)
36 static const struct mdoc_secname secnames
[SECNAME_MAX
] = {
38 { "LIBRARY", SEC_LIBRARY
},
39 { "SYNOPSIS", SEC_SYNOPSIS
},
40 { "DESCRIPTION", SEC_DESCRIPTION
},
41 { "IMPLEMENTATION NOTES", SEC_IMPLEMENTATION
},
42 { "EXIT STATUS", SEC_EXIT_STATUS
},
43 { "RETURN VALUES", SEC_RETURN_VALUES
},
44 { "ENVIRONMENT", SEC_ENVIRONMENT
},
45 { "FILES", SEC_FILES
},
46 { "EXAMPLES", SEC_EXAMPLES
},
47 { "DIAGNOSTICS", SEC_DIAGNOSTICS
},
48 { "COMPATIBILITY", SEC_COMPATIBILITY
},
49 { "ERRORS", SEC_ERRORS
},
50 { "SEE ALSO", SEC_SEE_ALSO
},
51 { "STANDARDS", SEC_STANDARDS
},
52 { "HISTORY", SEC_HISTORY
},
53 { "AUTHORS", SEC_AUTHORS
},
54 { "CAVEATS", SEC_CAVEATS
},
56 { "SECURITY CONSIDERATIONS", SEC_SECURITY
}
100 mdoc_isdelim(const char *p
)
107 return(mdoc_iscdelim(*p
));
112 mdoc_atosec(const char *p
)
116 for (i
= 0; i
< SECNAME_MAX
; i
++)
117 if (0 == strcmp(p
, secnames
[i
].name
))
118 return(secnames
[i
].sec
);
124 /* FIXME: move this into an editable .in file. */
126 mdoc_macro2len(int macro
)