summaryrefslogtreecommitdiff
path: root/usr.bin/man
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-10-31 10:38:05 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-10-31 10:38:05 +0000
commit60d5566b7eb61ee360724a5a3e12d9924b4f3d84 (patch)
tree7e837a8c0d4e3e9d04102a945c768481ad5883bf /usr.bin/man
parentf6aabf820fd038a813ba0a9c81e100092b9bb3a8 (diff)
Rewrite -m processing to not use queue internals and make it more
simple as well. ok hshoexer@ jaredy@ henning@
Diffstat (limited to 'usr.bin/man')
-rw-r--r--usr.bin/man/man.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c
index 15e766841af..1f47815a0e8 100644
--- a/usr.bin/man/man.c
+++ b/usr.bin/man/man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.c,v 1.29 2005/10/17 19:08:46 otto Exp $ */
+/* $OpenBSD: man.c,v 1.30 2005/10/31 10:38:04 otto Exp $ */
/* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-static char rcsid[] = "$OpenBSD: man.c,v 1.29 2005/10/17 19:08:46 otto Exp $";
+static char rcsid[] = "$OpenBSD: man.c,v 1.30 2005/10/31 10:38:04 otto Exp $";
#endif
#endif /* not lint */
@@ -266,25 +266,15 @@ main(int argc, char *argv[])
if ((ep = malloc(sizeof(ENTRY))) == NULL ||
(ep->s = strdup(buf)) == NULL)
err(1, NULL);
- /*
- * puts it at the end, should be at the top,
- * but then the added entries would be in
- * reverse order, fix later when all are added
- */
- TAILQ_INSERT_TAIL(&defp->list, ep, q);
+
if (e_sectp == NULL)
- /* save first added, to-be the new top */
- e_sectp = ep;
+ TAILQ_INSERT_HEAD(&defp->list, ep, q);
+ else
+ TAILQ_INSERT_AFTER(&defp->list, e_sectp,
+ ep, q);
+ e_sectp = ep;
}
}
- if (e_sectp != NULL) { /* entries added, fix order */
- /* save original head */
- TAILQ_NEXT(ep, q) = TAILQ_FIRST(&defp->list);
- /* first added entry, new top */
- TAILQ_FIRST(&defp->list) = e_sectp;
- /* terminate list */
- *e_sectp->q.tqe_prev = NULL;
- }
}
/*
* 4: If no -m was specified, and a section was, rewrite the section's