summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--html.c28
-rw-r--r--html.h14
-rw-r--r--main.c6
-rw-r--r--man_html.c3
-rw-r--r--mdoc_html.c12
5 files changed, 31 insertions, 32 deletions
diff --git a/html.c b/html.c
index aa710d03..850d4274 100644
--- a/html.c
+++ b/html.c
@@ -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 6846c965..9a1df429 100644
--- a/html.h
+++ b/html.h
@@ -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 69ae0e7a..1663e8be 100644
--- a/main.c
+++ b/main.c
@@ -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 113d00b2..eb6abebf 100644
--- a/man_html.c
+++ b/man_html.c
@@ -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 552ac3df..d659abff 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -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);
}