aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-23 13:05:06 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-23 13:05:06 +0000
commit7afe8a4e9da86c2e69030ba80f8fb4412d0e1307 (patch)
treec62275ffdac242fb74590b770c3cc5d2ea6549e8
parent87afbc0e736c0c51230aed2a74f1f10684872d7e (diff)
downloadmandoc-7afe8a4e9da86c2e69030ba80f8fb4412d0e1307.tar.gz
mandoc-7afe8a4e9da86c2e69030ba80f8fb4412d0e1307.tar.zst
mandoc-7afe8a4e9da86c2e69030ba80f8fb4412d0e1307.zip
Added mdoclint.
`make regress' uses mdoclint
-rw-r--r--Makefile33
-rw-r--r--README.addmacro (renamed from READE.addmacro)2
-rw-r--r--README.addregress7
-rw-r--r--mdoclint.c44
-rw-r--r--mdocterm.15
-rw-r--r--mdoctree.15
6 files changed, 80 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 1ef89465..bf08ff06 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,8 @@ TREELNS = mdoctree.ln mmain.ln
TERMLNS = mdoctree.ln mmain.ln term.ln
+LINTLNS = mdoclint.ln mmain.ln
+
LNS = $(LIBLNS) $(TREELNS) $(TERMLNS)
LLNS = llib-llibmdoc.ln llib-lmdoctree.ln llib-lmdocterm.ln
@@ -22,16 +24,18 @@ TERMOBJS= mdocterm.o mmain.o term.o
TREEOBJS= mdoctree.o mmain.o
+LINTOBJS= mdoclint.o mmain.o
+
OBJS = $(LIBOBJS) $(TERMOBJS) $(TREEOBJS)
SRCS = macro.c mdoc.c hash.c strings.c xstd.c argv.c validate.c \
- action.c term.c mdoctree.c mdocterm.c mmain.c
+ action.c term.c mdoctree.c mdocterm.c mmain.c mdoclint.c
HEADS = mdoc.h private.h term.h mmain.h
MANS = mdoctree.1 mdocterm.1 mdoc.3
-BINS = mdocterm mdoctree
+BINS = mdocterm mdoctree mdoclint
CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS)
@@ -64,10 +68,7 @@ FAIL = regress/test.empty \
regress/test.prologue.33 \
regress/test.sh.01 \
regress/test.sh.02 \
- regress/test.sh.03 \
- regress/test.name.01 \
- regress/test.name.02 \
- regress/test.name.03
+ regress/test.sh.03
SUCCEED = regress/test.prologue.05 \
regress/test.prologue.07 \
@@ -81,6 +82,9 @@ SUCCEED = regress/test.prologue.05 \
regress/test.prologue.20 \
regress/test.sh.00 \
regress/test.name.00 \
+ regress/test.name.01 \
+ regress/test.name.02 \
+ regress/test.name.03 \
regress/test.list.00 \
regress/test.list.01 \
regress/test.list.02 \
@@ -100,13 +104,13 @@ dist: mdocml-$(VERSION).tar.gz
port: mdocml-oport-$(VERSION).tar.gz
-regress:: mdocml
+regress:: mdoclint
@for f in $(FAIL); do \
- echo "./mdocml $$f" ; \
- ./mdocml $$f 2>/dev/null || continue ; exit 1 ; done
+ echo "./mdoclint $$f" ; \
+ ./mdoclint $$f 2>/dev/null || continue ; exit 1 ; done
@for f in $(SUCCEED); do \
- echo "./mdocml $$f" ; \
- ./mdocml $$f 2>/dev/null || exit 1 ; done
+ echo "./mdoclint $$f" ; \
+ ./mdoclint $$f 2>/dev/null || exit 1 ; done
install:
mkdir -p $(PREFIX)/bin/
@@ -154,6 +158,9 @@ mdoc.o: mdoc.c private.h
mdocterm.ln: mdocterm.c mmain.h
mdocterm.o: mdocterm.c mmain.h
+mdoclint.ln: mdoclint.c mmain.h
+mdoclint.o: mdoclint.c mmain.h
+
mdoctree.ln: mdoctree.c mmain.h
mdoctree.o: mdoctree.c mmain.h
@@ -188,10 +195,12 @@ mdocml-oport-$(VERSION).tar.gz: Makefile.port DESCR
echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
echo bin/mdocterm >> .dist/mdocml/pkg/PLIST
echo bin/mdoctree >> .dist/mdocml/pkg/PLIST
+ echo bin/mdoclint >> .dist/mdocml/pkg/PLIST
echo lib/libmdoc.a >> .dist/mdocml/pkg/PLIST
echo include/mdoc.h >> .dist/mdocml/pkg/PLIST
echo @man man/man1/mdoctree.1 >> .dist/mdocml/pkg/PLIST
echo @man man/man1/mdocterm.1 >> .dist/mdocml/pkg/PLIST
+ echo @man man/man1/mdoclint.1 >> .dist/mdocml/pkg/PLIST
echo @man man/man3/mdoc.3 >> .dist/mdocml/pkg/PLIST
( cd .dist/ && tar zcf ../$@ mdocml/ )
rm -rf .dist/
@@ -220,3 +229,5 @@ mdocterm: $(TERMOBJS) libmdoc.a
mdoctree: $(TREEOBJS) libmdoc.a
$(CC) $(CFLAGS) -o $@ $(TREEOBJS) libmdoc.a
+mdoclint: $(LINTOBJS) libmdoc.a
+ $(CC) $(CFLAGS) -o $@ $(LINTOBJS) libmdoc.a
diff --git a/READE.addmacro b/README.addmacro
index b79f90e2..8bdea891 100644
--- a/READE.addmacro
+++ b/README.addmacro
@@ -1,4 +1,4 @@
-$Id: READE.addmacro,v 1.1 2009/02/23 12:45:19 kristaps Exp $
+$Id: README.addmacro,v 1.1 2009/02/23 13:05:06 kristaps Exp $
This documents how to go about adding a macro to mdoc.3.
diff --git a/README.addregress b/README.addregress
new file mode 100644
index 00000000..c7b72181
--- /dev/null
+++ b/README.addregress
@@ -0,0 +1,7 @@
+$Id: README.addregress,v 1.1 2009/02/23 13:05:06 kristaps Exp $
+
+To add regression tests, name the file according as
+regress/test.NAME.NN, where NAME approximately documents the test domain
+and NN is a two-digit, zero-padded number for the test index.
+
+Subsequent that, add the test to either FAIL or SUCCEED in the Makefile.
diff --git a/mdoclint.c b/mdoclint.c
new file mode 100644
index 00000000..b7247c12
--- /dev/null
+++ b/mdoclint.c
@@ -0,0 +1,44 @@
+ /* $Id: mdoclint.c,v 1.1 2009/02/23 13:05:06 kristaps Exp $ */
+/*
+ * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#include <assert.h>
+#include <err.h>
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mmain.h"
+
+int
+main(int argc, char *argv[])
+{
+ struct mmain *p;
+ const struct mdoc *mdoc;
+
+ p = mmain_alloc();
+
+ if ( ! mmain_getopt(p, argc, argv, NULL, NULL, NULL, NULL))
+ mmain_exit(p, 1);
+
+ if (NULL == (mdoc = mmain_mdoc(p)))
+ mmain_exit(p, 1);
+
+ mmain_exit(p, 0);
+ /* NOTREACHED */
+}
+
diff --git a/mdocterm.1 b/mdocterm.1
index 0ad49030..fbc798f1 100644
--- a/mdocterm.1
+++ b/mdocterm.1
@@ -1,4 +1,4 @@
-.\" $Id: mdocterm.1,v 1.2 2009/02/22 11:23:19 kristaps Exp $
+.\" $Id: mdocterm.1,v 1.3 2009/02/23 13:05:06 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -16,7 +16,7 @@
.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 22 2009 $
+.Dd $Mdocdate: February 23 2009 $
.Dt mdocmterm 1
.Os
.\" SECTION
@@ -103,6 +103,7 @@ To pipe a manual page to the pager:
.\" SECTION
.Sh SEE ALSO
.Xr mdoctree 1 ,
+.Xr mdoclint 1 ,
.Xr mdoc.samples 7 ,
.Xr mdoc 7 ,
.Xr mdoc 3
diff --git a/mdoctree.1 b/mdoctree.1
index 3d96f0f3..a67f992f 100644
--- a/mdoctree.1
+++ b/mdoctree.1
@@ -1,4 +1,4 @@
-.\" $Id: mdoctree.1,v 1.3 2009/02/22 19:23:48 kristaps Exp $
+.\" $Id: mdoctree.1,v 1.4 2009/02/23 13:05:06 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -16,7 +16,7 @@
.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 22 2009 $
+.Dd $Mdocdate: February 23 2009 $
.Dt mdoctree 1
.Os
.\" SECTION
@@ -101,6 +101,7 @@ To validate this manual page:
.\" SECTION
.Sh SEE ALSO
.Xr mdocterm 1 ,
+.Xr mdoclint 1 ,
.Xr mdoc.samples 7 ,
.Xr mdoc 7 ,
.Xr mdoc 3