diff --git a/Makefile b/Makefile index 8a7466e..b1c85c2 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,8 @@ clean: $(MAKE) -C embed clean docs: README.md doc/ctpv.1 - ./deplist.awk $(PRE) | ./deplist.md.sh | ./deplistadd.sh README.md - ./deplist.awk $(PRE) | ./deplist.1.sh | ./deplistadd.sh doc/ctpv.1 + deptable/list.awk $(PRE) | deptable/markdown.sh | deptable/insert.sh README.md + deptable/list.awk $(PRE) | deptable/roff.sh | deptable/insert.sh doc/ctpv.1 ctpv: $(OBJ) $(CC) -o $@ $+ $(LDFLAGS) diff --git a/deplistadd.sh b/deptable/insert.sh similarity index 68% rename from deplistadd.sh rename to deptable/insert.sh index 4fe3f07..4615042 100755 --- a/deplistadd.sh +++ b/deptable/insert.sh @@ -1,11 +1,14 @@ #!/bin/sh +set -e + +tmp="$(mktemp XXXXXX)" table="$(mktemp XXXXXX)" trap 'rm "$table"' EXIT cat > "$table" -sed -i " +sed " /TABLESTART/,/TABLEEND/ { /TABLESTART/ { r $table @@ -13,4 +16,6 @@ sed -i " } /TABLEEND/!d } -" "$1" +" "$1" > "$tmp" + +mv -- "$tmp" "$1" diff --git a/deplist.awk b/deptable/list.awk similarity index 100% rename from deplist.awk rename to deptable/list.awk diff --git a/deplist.md.sh b/deptable/markdown.sh similarity index 100% rename from deplist.md.sh rename to deptable/markdown.sh diff --git a/deplist.1.sh b/deptable/roff.sh similarity index 100% rename from deplist.1.sh rename to deptable/roff.sh