From afb2dbb6cd0e0214f352338c0abb880d02986242 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 8 Mar 2009 19:32:03 +0000 Subject: Fixed strings.sh to work with NetBSD. Fixed various lint warnings. --- Makefile | 2 +- macro.c | 2 +- mmain.c | 6 +++--- strings.sh | 13 ++++++++----- 4 files changed, 13 insertions(+), 10 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 c1dedefa..e1de6b53 100644 --- a/macro.c +++ b/macro.c @@ -238,7 +238,7 @@ scopewarn(struct mdoc *mdoc, enum mdoc_type type, n = t = ""; tt = "block"; - switch (p->type) { + switch (type) { case (MDOC_BODY): tt = "multi-line"; break; diff --git a/mmain.c b/mmain.c index c823901f..e8df8dbd 100644 --- a/mmain.c +++ b/mmain.c @@ -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 47753535..4fdb5273 100644 --- a/strings.sh +++ b/strings.sh @@ -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 <