summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-23 15:34:53 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-23 15:34:53 +0000
commit4cd5b88b9ab0146c48e737ba2e83f5d7fa273d1d (patch)
treeb3000d4427384d6500250dd246c760be994ff0bf
parent208a41e586edfd25d5c60acb38932f689d5d1a43 (diff)
downloadmandoc-4cd5b88b9ab0146c48e737ba2e83f5d7fa273d1d.tar.gz
mandoc-4cd5b88b9ab0146c48e737ba2e83f5d7fa273d1d.tar.zst
mandoc-4cd5b88b9ab0146c48e737ba2e83f5d7fa273d1d.zip
Compiles fine on NetBSD now, too.
-rw-r--r--argv.c5
-rw-r--r--mdocterm.c24
-rw-r--r--mmain.h21
-rw-r--r--strings.c4
4 files changed, 31 insertions, 23 deletions
diff --git a/argv.c b/argv.c
index aed85c42..5f591f3c 100644
--- a/argv.c
+++ b/argv.c
@@ -1,4 +1,4 @@
-/* $Id: argv.c,v 1.28 2009/02/23 15:19:47 kristaps Exp $ */
+/* $Id: argv.c,v 1.29 2009/02/23 15:34:53 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -715,7 +715,7 @@ int
mdoc_argv(struct mdoc *mdoc, int line, int tok,
struct mdoc_arg *v, int *pos, char *buf)
{
- int i, ppos;
+ int i;
char *p;
(void)memset(v, 0, sizeof(struct mdoc_arg));
@@ -758,7 +758,6 @@ mdoc_argv(struct mdoc *mdoc, int line, int tok,
/* FIXME: whitespace if no value. */
- ppos = *pos;
if ( ! argv(mdoc, line, v, pos, buf))
return(ARGV_ERROR);
diff --git a/mdocterm.c b/mdocterm.c
index 7ffa0a3e..0995da7d 100644
--- a/mdocterm.c
+++ b/mdocterm.c
@@ -1,4 +1,4 @@
- /* $Id: mdocterm.c,v 1.6 2009/02/23 15:19:47 kristaps Exp $ */
+ /* $Id: mdocterm.c,v 1.7 2009/02/23 15:34:53 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -24,13 +24,19 @@
#include <stdlib.h>
#include <string.h>
-#ifdef __linux__
+#ifndef __OpenBSD__
#include <time.h>
#endif
#include "mmain.h"
#include "term.h"
+#ifdef __NetBSD__
+#define xisspace(x) isspace((int)(x))
+#else
+#define xisspace(x) isspace((x))
+#endif
+
enum termstyle {
STYLE_CLEAR,
STYLE_BOLD,
@@ -137,11 +143,11 @@ flushln(struct termp *p)
* Count up visible word characters. Control sequences
* (starting with the CSI) aren't counted.
*/
- assert( ! isspace(p->buf[i]));
+ assert( ! xisspace(p->buf[i]));
/* LINTED */
for (j = i, vsz = 0; j < p->col; j++) {
- if (isspace(p->buf[j]))
+ if (xisspace(p->buf[j]))
break;
else if (27 == p->buf[j]) {
assert(j + 4 <= p->col);
@@ -177,7 +183,7 @@ flushln(struct termp *p)
*/
for ( ; i < p->col; i++) {
- if (isspace(p->buf[i]))
+ if (xisspace(p->buf[i]))
break;
putchar(p->buf[i]);
}
@@ -378,7 +384,7 @@ word(struct termp *p, const char *word)
/* LINTED */
for (j = i = 0; i < len; i++) {
- if ( ! isspace(word[i])) {
+ if ( ! xisspace(word[i])) {
j++;
continue;
}
@@ -444,10 +450,10 @@ footer(struct termp *p, const struct mdoc_meta *meta)
tm = localtime(&meta->date);
-#ifdef __linux__
- if (0 == strftime(buf, p->rmargin, "%B %d, %Y", tm))
-#else
+#ifdef __OpenBSD__
if (NULL == strftime(buf, p->rmargin, "%B %d, %Y", tm))
+#else
+ if (0 == strftime(buf, p->rmargin, "%B %d, %Y", tm))
#endif
err(1, "strftime");
diff --git a/mmain.h b/mmain.h
index b31020d1..1af69857 100644
--- a/mmain.h
+++ b/mmain.h
@@ -1,4 +1,4 @@
-/* $Id: mmain.h,v 1.3 2009/02/23 12:45:19 kristaps Exp $ */
+/* $Id: mmain.h,v 1.4 2009/02/23 15:34:53 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -28,8 +28,16 @@
#include "mdoc.h"
-#ifdef __linux__
-#define __dead /* Nothing */
+/* Rules for "dead" functions: */
+#if defined(__NetBSD__)
+#define dead_pre __dead
+#define dead_post __attribute__((__noreturn__))
+#elif defined(__OpenBSD__)
+#define dead_pre __dead
+#define dead_post /* Nothing. */
+#else
+#define dead_pre /* Nothing. */
+#define dead_post __attribute__((__noreturn__))
#endif
__BEGIN_DECLS
@@ -37,12 +45,7 @@ __BEGIN_DECLS
struct mmain;
struct mmain *mmain_alloc(void);
-#ifdef __linux__
-void mmain_exit(struct mmain *, int)
- __attribute__((__noreturn__));
-#else
-__dead void mmain_exit(struct mmain *, int);
-#endif
+dead_pre void mmain_exit(struct mmain *, int) dead_post;
int mmain_getopt(struct mmain *, int, char *[],
const char *, const char *, void *,
int (*)(void *, int, const char *));
diff --git a/strings.c b/strings.c
index 1d4fd305..e7538cf5 100644
--- a/strings.c
+++ b/strings.c
@@ -1,4 +1,4 @@
-/* $Id: strings.c,v 1.14 2009/02/23 12:45:19 kristaps Exp $ */
+/* $Id: strings.c,v 1.15 2009/02/23 15:34:53 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifdef __linux__
+#ifndef __OpenBSD__
#include <time.h>
#endif