ref: e9c7dc18d0822fb48455be3bcc96b9eca6c8a142
parent: 6c792854e115de8998dcf5d8beca5cf1bb6b6e4d
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Aug 20 03:46:02 EDT 2018
Don't use a temporary file in mkdep.sh Ed is THE editor!.
--- a/mkdep.sh
+++ b/mkdep.sh
@@ -1,9 +1,9 @@
#!/bin/sh
set -e
-trap "rm -f $$.tmp" 0 2 3
-(sed '/^#deps/q' deps.mk
+(echo '/^#deps/+;$c'
+
for i in `find . -name '*.c'`
do
file=`basename $i | sed 's/\.c$/.o/'`
@@ -13,4 +13,7 @@
sed -n "/#include \"/ s,#include \"\(.*\)\",$dir$file: $dir\1,p" $i
done |
-LC_ALL=C sort -s) > $$.tmp && mv $$.tmp deps.mk
+LC_ALL=C sort -s
+
+echo .
+echo w) | ed -s deps.mk