1
0
Fork 0

more changes

This commit is contained in:
dtb 2023-08-17 17:51:47 -04:00
parent 4f7d204f5a
commit aa110975ae
3 changed files with 13 additions and 21 deletions

View File

@ -8,11 +8,10 @@ argued \(en check for arguments
Argued exits successfully if any arguments are provided, and unsuccessfully otherwise.
.SH STANDARDS
Argued is not described in POSIX.1-2017.
Argued's function may be performed on a purely POSIX system with test(1).
.SH COPYRIGHT
Public domain.
.SH SEE ALSO
str(1), test(1)

View File

@ -5,33 +5,29 @@ set -e
str isvalue "$MANUAL_DIR" \
|| MANUAL_DIR=/usr/manual
argv0="$0"
# normalization
! str isvalue "$1" || str isvalue "$3" \
&& printf "Usage: %s [name] (section)\n" "$argv0" 1>&2 \
&& exit 1 \
|| true
|| \
str isvalue "$2" && ! test -e "$MANUAL_DIR/$2/$1" \
&& printf "%s: %s: No manual entry in section %s\n" "$0" "$1" "$2" \
1>&2 \
&& exit 1 \
|| true
|| \
str isvalue "$2" \
&& PAGE="$MANUAL_DIR/$2/$1" \
|| for d in "$MANUAL_DIR"/*
do test -e "$d/$1" && PAGE="$d/$1"
done
# lookup + execution
! str isvalue "$PAGE" \
&& printf "%s: %s: No manual entry\n" "$0" "$1" 1>&2 \
&& exit 1 \
|| true
|| \
! str isvalue "$SECTION_DIR" \
&& printf "%s: %s: No manual entry\n" "$argv0" "$1" 1>&2 \
&& exit 1 \
|| true
|| \
<"$PAGE" groff -t -e -mandoc -Tascii

View File

@ -3,13 +3,10 @@ TARGETS = str
all: $(TARGETS)
str: %.c
$(CC) -o $@ $@.c
str: str.c
$(CC) -DINCLUDE_ISVALUE=1 -o $@ $@.c
clean:
$(RM) $(TARGETS)
sane: str.c ../include/sysexits.h
$(CC) -DDONT_USE_SYSTEM_SYSEXITS -o str str.c
.PHONY: all clean sane
.PHONY: all clean