From edd4507a9edff255a67ce707442560a4ec4b3b14 Mon Sep 17 00:00:00 2001 From: Gerd Knorr Date: Wed, 13 Oct 2004 10:38:59 +0000 Subject: - kill trailing whitespaces. --- v4l/scripts/strip-trailing-whitespaces.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'v4l') diff --git a/v4l/scripts/strip-trailing-whitespaces.sh b/v4l/scripts/strip-trailing-whitespaces.sh index 592320e6a..6e6c7d8bb 100644 --- a/v4l/scripts/strip-trailing-whitespaces.sh +++ b/v4l/scripts/strip-trailing-whitespaces.sh @@ -1,8 +1,15 @@ #!/bin/sh + +# tmp dir for my files +WORK="${TMPDIR-/tmp}/${0##*/}-$$" +mkdir "$WORK" || exit 1 +trap 'rm -rf "$WORK"' EXIT + for file in *.[ch]; do - echo "### file" - tmpfile="${file}.$$" - perl -ne 's/[ \t]+$//; print' < "${file}" > "$tmpfile" - diff -u "$file" "$tmpfile" + tmpfile="$WORK/${file}.$$" + perl -ne 's/[ \t]+$//; print' < "${file}" > "${tmpfile}" + diff -u "${file}" "${tmpfile}" | sed \ + -e "s|^--- ${file}|--- ${file}.orig|" \ + -e "s|^+++ ${tmpfile}|+++ ${file}|" rm -f "$tmpfile" done -- cgit v1.2.3