summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-08 19:32:03 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-08 19:32:03 +0000
commit82ebd2e467651cc6ec63d8a1bc9b6e5cedb01410 (patch)
tree334ace4e3affb063a3c1df0ad995850a23af77ff
parentdc7c7fae796f0d87b47ae5747a1820e7173380a0 (diff)
downloadmandoc-82ebd2e467651cc6ec63d8a1bc9b6e5cedb01410.tar.gz
mandoc-82ebd2e467651cc6ec63d8a1bc9b6e5cedb01410.tar.zst
mandoc-82ebd2e467651cc6ec63d8a1bc9b6e5cedb01410.zip
Fixed strings.sh to work with NetBSD.
Fixed various lint warnings.
-rw-r--r--Makefile2
-rw-r--r--macro.c4
-rw-r--r--mmain.c8
-rw-r--r--strings.sh15
4 files changed, 16 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index b9928f58..9a7fdac5 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,8 @@ INSTALL_DATA = install -m 0444
INSTALL_LIB = install -m 0644
INSTALL_MAN = $(INSTALL_DATA)
+CPPFLAGS = -DVERSION=\"$(VERSION)\"
CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -g
-CFLAGS += -DVERSION=\"$(VERSION)\"
LIBLNS = macro.ln mdoc.ln hash.ln strings.ln xstd.ln argv.ln \
validate.ln action.ln lib.ln att.ln arch.ln vol.ln \
diff --git a/macro.c b/macro.c
index edc19e03..548bc103 100644
--- a/macro.c
+++ b/macro.c
@@ -1,4 +1,4 @@
-/* $Id: macro.c,v 1.59 2009/03/08 18:02:36 kristaps Exp $ */
+/* $Id: macro.c,v 1.60 2009/03/08 19:32:03 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -238,7 +238,7 @@ scopewarn(struct mdoc *mdoc, enum mdoc_type type,
n = t = "<root>";
tt = "block";
- switch (p->type) {
+ switch (type) {
case (MDOC_BODY):
tt = "multi-line";
break;
diff --git a/mmain.c b/mmain.c
index 2c5894cd..52ff9a0a 100644
--- a/mmain.c
+++ b/mmain.c
@@ -1,4 +1,4 @@
- /* $Id: mmain.c,v 1.8 2009/03/08 18:50:40 kristaps Exp $ */
+ /* $Id: mmain.c,v 1.9 2009/03/08 19:32:03 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -41,7 +41,7 @@ struct mmain {
int dbg; /* Debug level. */
struct mdoc *mdoc; /* Active parser. */
char *buf; /* Input buffer. */
- u_long bufsz; /* Input buffer size. */
+ size_t bufsz; /* Input buffer size. */
char *in; /* Input file name. */
int fdin; /* Input file desc. */
int pflags; /* Parse flags. */
@@ -190,7 +190,7 @@ mmain_mdoc(struct mmain *p)
warn("%s", p->in);
p->bufsz = BUFSIZ;
} else
- p->bufsz = MAX(st.st_blksize, BUFSIZ);
+ p->bufsz = (size_t)MAX(st.st_blksize, BUFSIZ);
p->buf = malloc(p->bufsz);
if (NULL == p->buf)
@@ -283,7 +283,7 @@ parse(struct mmain *p)
for (i = 0; i < (int)sz; i++) {
if (pos >= len) {
len += MD_LINE_SZ;
- line = realloc(line, len);
+ line = realloc(line, (size_t)len);
if (NULL == line)
err(1, "realloc");
}
diff --git a/strings.sh b/strings.sh
index 18c54f28..54a00d4e 100644
--- a/strings.sh
+++ b/strings.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# $Id: strings.sh,v 1.2 2009/03/06 14:24:49 kristaps Exp $
+# $Id: strings.sh,v 1.3 2009/03/08 19:32:03 kristaps Exp $
# strings.sh [-o output] name input
#
@@ -45,11 +45,11 @@ fi
input=$2
if [ "$output" ]; then
- exec 1<>$output
+ exec >$output
fi
if [ "$input" ]; then
- exec 0<>$input
+ exec <$input
fi
cat <<!
@@ -67,9 +67,12 @@ mdoc_a2${name}(const char *p)
!
while read in ; do
- [ -z "$in" ] && continue;
- [ "#" == `echo "$in" | cut -c1` ] && continue;
-
+ if [ -z "$in" ]; then
+ continue
+ fi
+ if [ "#" = `echo "$in" | cut -c1` ]; then
+ continue
+ fi
key=`printf "%s\n" "$in" | cut -f 1`
val=`printf "%s\n" "$in" | cut -f 2- | sed 's!^[ ]*!!'`
cat <<!