summaryrefslogtreecommitdiffstatshomepage
path: root/strings.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-01-17 16:15:27 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-01-17 16:15:27 +0000
commita2320c4fc025a6262bc6cfa6e420d85fe8d60bd6 (patch)
treeb2c089949ddd571f223c3377bcf2f559195f2d88 /strings.c
parent3ef2ed38138f74f57e8bac7be877cd7f644c6fa5 (diff)
downloadmandoc-a2320c4fc025a6262bc6cfa6e420d85fe8d60bd6.tar.gz
mandoc-a2320c4fc025a6262bc6cfa6e420d85fe8d60bd6.tar.zst
mandoc-a2320c4fc025a6262bc6cfa6e420d85fe8d60bd6.zip
Documentation, more validations, cleaned up actions, added Nm action.
Diffstat (limited to 'strings.c')
-rw-r--r--strings.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/strings.c b/strings.c
index 33cc7b04..a94eb801 100644
--- a/strings.c
+++ b/strings.c
@@ -1,4 +1,4 @@
-/* $Id: strings.c,v 1.8 2009/01/16 12:23:25 kristaps Exp $ */
+/* $Id: strings.c,v 1.9 2009/01/17 16:15:27 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -81,47 +81,39 @@ mdoc_isdelim(const char *p)
enum mdoc_sec
-mdoc_atosec(size_t sz, const char **p)
+mdoc_atosec(const char *p)
{
- assert(sz > 0);
- if (sz > 2)
- return(SEC_CUSTOM);
- if (sz == 2) {
- if (0 == strcmp(*p, "RETURN") &&
- 0 == strcmp(*(p + 1), "VALUES"))
- return(SEC_RETURN_VALUES);
- if (0 == strcmp(*p, "SEE") &&
- 0 == strcmp(*(p + 1), "ALSO"))
- return(SEC_SEE_ALSO);
- return(SEC_CUSTOM);
- }
-
- if (0 == strcmp(*p, "NAME"))
+ assert(p);
+ if (0 == strcmp(p, "NAME"))
return(SEC_NAME);
- else if (0 == strcmp(*p, "SYNOPSIS"))
+ else if (0 == strcmp(p, "RETURN VALUES"))
+ return(SEC_RETURN_VALUES);
+ else if (0 == strcmp(p, "SEE ALSO"))
+ return(SEC_SEE_ALSO);
+ else if (0 == strcmp(p, "SYNOPSIS"))
return(SEC_SYNOPSIS);
- else if (0 == strcmp(*p, "DESCRIPTION"))
+ else if (0 == strcmp(p, "DESCRIPTION"))
return(SEC_DESCRIPTION);
- else if (0 == strcmp(*p, "ENVIRONMENT"))
+ else if (0 == strcmp(p, "ENVIRONMENT"))
return(SEC_ENVIRONMENT);
- else if (0 == strcmp(*p, "FILES"))
+ else if (0 == strcmp(p, "FILES"))
return(SEC_FILES);
- else if (0 == strcmp(*p, "EXAMPLES"))
+ else if (0 == strcmp(p, "EXAMPLES"))
return(SEC_EXAMPLES);
- else if (0 == strcmp(*p, "DIAGNOSTICS"))
+ else if (0 == strcmp(p, "DIAGNOSTICS"))
return(SEC_DIAGNOSTICS);
- else if (0 == strcmp(*p, "ERRORS"))
+ else if (0 == strcmp(p, "ERRORS"))
return(SEC_ERRORS);
- else if (0 == strcmp(*p, "STANDARDS"))
+ else if (0 == strcmp(p, "STANDARDS"))
return(SEC_STANDARDS);
- else if (0 == strcmp(*p, "HISTORY"))
+ else if (0 == strcmp(p, "HISTORY"))
return(SEC_HISTORY);
- else if (0 == strcmp(*p, "AUTHORS"))
+ else if (0 == strcmp(p, "AUTHORS"))
return(SEC_AUTHORS);
- else if (0 == strcmp(*p, "CAVEATS"))
+ else if (0 == strcmp(p, "CAVEATS"))
return(SEC_CAVEATS);
- else if (0 == strcmp(*p, "BUGS"))
+ else if (0 == strcmp(p, "BUGS"))
return(SEC_BUGS);
return(SEC_CUSTOM);