diff options
author | John Ankarström <john@ankarstrom.se> | 2021-06-15 08:07:05 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-06-15 08:07:05 +0200 |
commit | e2f959337ef84f2feb1e2f4e4f48674e174e8f38 (patch) | |
tree | 617b721ff9794f400801dc46bb1acda9fb4d7b28 | |
parent | 622f34e503fa79dfd9f85e553fdfbd3450f34401 (diff) | |
download | lbsd-e2f959337ef84f2feb1e2f4e4f48674e174e8f38.tar.gz |
(ROX) SendTo/diff: Re-arrange x, x.orig to x.orig, x
-rwxr-xr-x | home/john/.config/rox.sourceforge.net/SendTo/.group/diff | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/home/john/.config/rox.sourceforge.net/SendTo/.group/diff b/home/john/.config/rox.sourceforge.net/SendTo/.group/diff index b780c24..d29602e 100755 --- a/home/john/.config/rox.sourceforge.net/SendTo/.group/diff +++ b/home/john/.config/rox.sourceforge.net/SendTo/.group/diff @@ -1,5 +1,29 @@ #!/bin/sh + d="$(dirname "$1")/" cd "$d" + +# Re-arrange x, x.orig to x.orig, x +i=0 +while [ $((++i)) -le $# ]; do + if [ $i -le $# ]; then + if [ x"$1" = x"${2%.orig}" ]; then + a=$1 + b=$2 + shift 2 + : $((++i)) + set -- "$@" "$b" "$a" + else + a=$1 + shift + set -- "$@" "$a" + fi + else + a=$1 + shift + set -- "$@" "$a" + fi +done + t=diff; for x in "$@"; do t=$t" ${x#$d}"; done -exec xterm -title "$t" -e with-shell diff -u "$@" +exec xterm -title "$t" -e with-pager diff -u "$@" |