summaryrefslogtreecommitdiffstats
path: root/usr.bin/man/man.c
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2005-10-31 10:38:04 +0000
committerotto <otto@openbsd.org>2005-10-31 10:38:04 +0000
commit381b036df6fa732d6f2c0cfa9f94899fe17cde1b (patch)
tree37aa879ac8264fbd4528e8b769dd61ca6d38f5e5 /usr.bin/man/man.c
parentadd bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk> (diff)
downloadwireguard-openbsd-381b036df6fa732d6f2c0cfa9f94899fe17cde1b.tar.xz
wireguard-openbsd-381b036df6fa732d6f2c0cfa9f94899fe17cde1b.zip
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/man.c')
-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