summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-10-26 08:18:15 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-10-26 08:18:15 +0000
commitb7c56901be15b5853782a4ab0a8f85b745792d05 (patch)
treecfa8c49e546acb1c55de7195efe25105b79cb65b
parent65f3d725ab6475bef0a83e1077c3ce2be3557598 (diff)
downloadmandoc-b7c56901be15b5853782a4ab0a8f85b745792d05.tar.gz
mandoc-b7c56901be15b5853782a4ab0a8f85b745792d05.tar.zst
mandoc-b7c56901be15b5853782a4ab0a8f85b745792d05.zip
Portability: replaced queue macros in html.c (Joerg Sonnenberger).
Fixed "-o" residue. Added "-O" to usage() (-o didn't appear there either).
-rw-r--r--html.c30
-rw-r--r--html.h16
-rw-r--r--main.c8
-rw-r--r--man_html.c5
-rw-r--r--mdoc_html.c14
5 files changed, 36 insertions, 37 deletions
diff --git a/html.c b/html.c
index ab68ba59..502d2554 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.65 2009/10/20 05:45:21 kristaps Exp $ */
+/* $Id: html.c,v 1.66 2009/10/26 08:18:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -15,7 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
-#include <sys/queue.h>
#include <assert.h>
#include <err.h>
@@ -102,8 +101,8 @@ html_alloc(char *outopts)
if (NULL == (h = calloc(1, sizeof(struct html))))
return(NULL);
- SLIST_INIT(&h->tags);
- SLIST_INIT(&h->ords);
+ h->tags.head = NULL;
+ h->ords.head = NULL;
if (NULL == (h->symtab = chars_init(CHARS_HTML))) {
free(h);
@@ -138,15 +137,13 @@ html_free(void *p)
h = (struct html *)p;
- while ( ! SLIST_EMPTY(&h->ords)) {
- ord = SLIST_FIRST(&h->ords);
- SLIST_REMOVE_HEAD(&h->ords, entry);
+ while ((ord = h->ords.head) != NULL) {
+ h->ords.head = ord->next;
free(ord);
}
- while ( ! SLIST_EMPTY(&h->tags)) {
- tag = SLIST_FIRST(&h->tags);
- SLIST_REMOVE_HEAD(&h->tags, entry);
+ while ((tag = h->tags.head) != NULL) {
+ h->tags.head = tag->next;
free(tag);
}
@@ -358,7 +355,8 @@ print_otag(struct html *h, enum htmltag tag,
if (NULL == (t = malloc(sizeof(struct tag))))
err(EXIT_FAILURE, "malloc");
t->tag = tag;
- SLIST_INSERT_HEAD(&h->tags, t, entry);
+ t->next = h->tags.head;
+ h->tags.head = t;
} else
t = NULL;
@@ -468,10 +466,9 @@ print_tagq(struct html *h, const struct tag *until)
{
struct tag *tag;
- while ( ! SLIST_EMPTY(&h->tags)) {
- tag = SLIST_FIRST(&h->tags);
+ while ((tag = h->tags.head) != NULL) {
print_ctag(h, tag->tag);
- SLIST_REMOVE_HEAD(&h->tags, entry);
+ h->tags.head = tag->next;
free(tag);
if (until && tag == until)
return;
@@ -484,12 +481,11 @@ print_stagq(struct html *h, const struct tag *suntil)
{
struct tag *tag;
- while ( ! SLIST_EMPTY(&h->tags)) {
- tag = SLIST_FIRST(&h->tags);
+ while ((tag = h->tags.head) != NULL) {
if (suntil && tag == suntil)
return;
print_ctag(h, tag->tag);
- SLIST_REMOVE_HEAD(&h->tags, entry);
+ h->tags.head = tag->next;
free(tag);
}
}
diff --git a/html.h b/html.h
index 1bb688e1..ea2b98c6 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.13 2009/10/13 10:21:24 kristaps Exp $ */
+/* $Id: html.h,v 1.14 2009/10/26 08:18:16 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -62,18 +62,22 @@ enum htmlattr {
};
struct tag {
+ struct tag *next;
enum htmltag tag;
- SLIST_ENTRY(tag) entry;
};
struct ord {
- int pos;
+ struct ord *next;
const void *cookie;
- SLIST_ENTRY(ord) entry;
+ int pos;
};
-SLIST_HEAD(tagq, tag);
-SLIST_HEAD(ordq, ord);
+struct tagq {
+ struct tag *head;
+};
+struct ordq {
+ struct ord *head;
+};
struct htmlpair {
enum htmlattr key;
diff --git a/main.c b/main.c
index d832541f..c325066b 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.47 2009/10/26 04:15:42 kristaps Exp $ */
+/* $Id: main.c,v 1.48 2009/10/26 08:18:16 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -134,7 +134,7 @@ main(int argc, char *argv[])
if ( ! moptions(&curp.inttype, optarg))
return(EXIT_FAILURE);
break;
- case ('o'):
+ case ('O'):
curp.outopts = optarg;
break;
case ('T'):
@@ -221,8 +221,8 @@ usage(void)
{
(void)fprintf(stderr, "usage: %s [-V] [-foption...] "
- "[-mformat] [-Toutput] [-Werr...]\n",
- __progname);
+ "[-mformat] [-Ooption] [-Toutput] "
+ "[-Werr...]\n", __progname);
exit(EXIT_FAILURE);
}
diff --git a/man_html.c b/man_html.c
index 3ff82ae9..82fed356 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.13 2009/10/24 05:45:04 kristaps Exp $ */
+/* $Id: man_html.c,v 1.14 2009/10/26 08:18:16 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -15,7 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
-#include <sys/queue.h>
#include <assert.h>
#include <ctype.h>
@@ -180,7 +179,7 @@ print_man_node(MAN_ARGS)
struct tag *t;
child = 1;
- t = SLIST_FIRST(&h->tags);
+ t = h->tags.head;
bufinit(h);
diff --git a/mdoc_html.c b/mdoc_html.c
index 6a05a918..a948781c 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.38 2009/10/26 04:09:45 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.39 2009/10/26 08:18:16 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -16,7 +16,6 @@
*/
#include <sys/types.h>
#include <sys/param.h>
-#include <sys/queue.h>
#include <assert.h>
#include <ctype.h>
@@ -417,7 +416,7 @@ print_mdoc_node(MDOC_ARGS)
struct tag *t;
child = 1;
- t = SLIST_FIRST(&h->tags);
+ t = h->tags.head;
bufinit(h);
switch (n->type) {
@@ -981,7 +980,7 @@ mdoc_it_head_pre(MDOC_ARGS, int type, struct roffsu *width)
print_otag(h, TAG_SPAN, 1, &tag);
break;
case (MDOC_Enum):
- ord = SLIST_FIRST(&h->ords);
+ ord = h->ords.head;
assert(ord);
nbuf[BUFSIZ - 1] = 0;
(void)snprintf(nbuf, BUFSIZ - 1, "%d.", ord->pos++);
@@ -1116,7 +1115,8 @@ mdoc_bl_pre(MDOC_ARGS)
err(EXIT_FAILURE, "malloc");
ord->cookie = n;
ord->pos = 1;
- SLIST_INSERT_HEAD(&h->ords, ord, entry);
+ ord->next = h->ords.head;
+ h->ords.head = ord;
return(1);
}
@@ -1132,9 +1132,9 @@ mdoc_bl_post(MDOC_ARGS)
if (MDOC_Enum != a2list(n))
return;
- ord = SLIST_FIRST(&h->ords);
+ ord = h->ords.head;
assert(ord);
- SLIST_REMOVE_HEAD(&h->ords, entry);
+ h->ords.head = ord->next;
free(ord);
}