#! /bin/sh

f="$1"
orig="${2:-$f}"


cleanup () {
    rm -f "$f".tmp
}

trap 'ec=$?; cleanup; exit $ec' EXIT QUIT INT TERM

set -e
cat > "$f".tmp <<EOF
%% @doc automatically generated scanner
%% @private
%% @end
-file("$orig", 0).
EOF
cat "$f" >> "$f".tmp
touch -r "$f" "$f".tmp
mv "$f.tmp"  "$f"
