diff --git a/misc/archive/bked.sh b/misc/archive/bked.sh index 08c7b1f90..2ff3edd4d 100644 --- a/misc/archive/bked.sh +++ b/misc/archive/bked.sh @@ -22,5 +22,15 @@ # # --- ROCK-COPYRIGHT-NOTE-END --- -for x ; do [ -f $x.orig ] || cp -v $x $x.orig ; done -$EDITOR "$@" +for x; do + if [ "${x#-}" != "$x" ]; then + continue + fi + if [ ! -f $x.orig ]; then + touch $x + cp -v $x $x.orig + fi +done + +${EDITOR:-vi} "$@" + diff --git a/misc/archive/xdiff.sh b/misc/archive/xdiff.sh index fb26a302f..da738514c 100644 --- a/misc/archive/xdiff.sh +++ b/misc/archive/xdiff.sh @@ -22,8 +22,10 @@ # # --- ROCK-COPYRIGHT-NOTE-END --- -list="`find $* -name '*.orig'`" - -for x in $list -do diff -ud $x `echo $x | sed 's,\.orig$,,'` +for x in $( { find "$@" -name '*.orig' -type f; find "$@" -maxdepth 0 -type f; } | sed 's,\.orig$,,' | sort -u; ) +do + if [ -f "$x" -a -f "$x.orig" ]; then + diff -ud "$x.orig" "$x" + fi done +