2012-08-26 22:09:34 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-08-26 22:13:57 +00:00
|
|
|
DIFF="git diff -U2 --no-index --color-words"
|
2012-08-26 22:09:34 +00:00
|
|
|
CMD="/usr/bin/env luajit ./map2text.lua"
|
|
|
|
|
2012-08-26 22:13:57 +00:00
|
|
|
opt=""
|
|
|
|
|
2012-08-26 22:09:34 +00:00
|
|
|
if [ `uname -s` != "Linux" ]; then
|
|
|
|
# I think 'tempfile' isn't in POSIX. Feel free to use 'mktemp' or something
|
|
|
|
# but absolutely test it before.
|
|
|
|
echo "This helper script is for Linux only."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2012-08-26 22:13:57 +00:00
|
|
|
if [ "$1" = "-c" -o "$1" = "-C" ]; then
|
|
|
|
opt="$1"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2012-08-26 22:09:34 +00:00
|
|
|
if [ -z "$1" -o -z "$2" ]; then
|
2012-08-26 22:13:57 +00:00
|
|
|
echo "Usage: ./mapdiff.sh [-c] <file.map> <file2.map>"
|
2012-08-26 22:09:34 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
tf1=`tempfile`
|
|
|
|
tf2=`tempfile`
|
|
|
|
|
2012-08-26 22:13:57 +00:00
|
|
|
$CMD $opt "$1" > "$tf1"
|
|
|
|
$CMD $opt "$2" > "$tf2"
|
2012-08-26 22:09:34 +00:00
|
|
|
|
|
|
|
$DIFF "$tf1" "$tf2"
|
|
|
|
|
|
|
|
rm "$tf1"
|
|
|
|
rm "$tf2"
|