Added some usefull tools.

git-svn-id: http://yate.null.ro/svn/yate/trunk@328 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-05-05 14:50:34 +00:00
parent 694e888d06
commit 6a8ff126f0
5 changed files with 93 additions and 0 deletions

5
tools/.cvsignore Normal file
View File

@ -0,0 +1,5 @@
Makefile
core*
*.orig
*~
.*.swp

9
tools/mkpatch.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
#
# Use:
# cd base-source-directory
# mkpatch >file.patch
# Before editing files create copies with .orig extension
# cp -p somefile.c somefile.c.orig
find . -name '*.orig' -exec echo diff -u {} {} \; | sed 's+\.orig$++' | /bin/sh

31
tools/tabify.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
cmd=""
case "$1" in
-h|--help)
echo "usage: tabify [--size <number>] file [file...]"
exit 0
;;
-s|--size)
shift
while [ ${#cmd} -lt "$1" ]; do cmd=" $cmd"; done
shift
;;
esac
test -z "$cmd" && cmd=" "
tmp=".$$.tmp"
cmd=": again; s/^\\( *\\)$cmd/\\1 /; t again"
if [ "$#" = "0" ]; then
sed "$cmd"
exit 0
fi
while [ "$#" != "0" ]; do
if [ -f "$1" ]; then
sed "$cmd" <"$1" >"$1$tmp"
mv "$1$tmp" "$1"
else
echo "Skipping missing file '$1'"
fi
shift
done

31
tools/untabify.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
cmd=""
case "$1" in
-h|--help)
echo "usage: untabify [--size <number>] file [file...]"
exit 0
;;
-s|--size)
shift
while [ ${#cmd} -lt "$1" ]; do cmd=" $cmd"; done
shift
;;
esac
test -z "$cmd" && cmd=" "
tmp=".$$.tmp"
cmd=": again; s/^\\( *\\) /\\1$cmd/; t again"
if [ "$#" = "0" ]; then
sed "$cmd"
exit 0
fi
while [ "$#" != "0" ]; do
if [ -f "$1" ]; then
sed "$cmd" <"$1" >"$1$tmp"
mv "$1$tmp" "$1"
else
echo "Skipping missing file '$1'"
fi
shift
done

17
tools/upcopy.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
cpy="$1"
test -n "$cpy" && cpy="2004, 2005"
grep -l -r '^ \* Copyright (C) .* Null Team$' * | while read fn; do
echo $fn
sed 's/^\( \* Copyright (C) \).*\( Null Team\)$/\1'"$cpy"'\2/' < "$fn" > "$fn.tmp"
if cmp -s "$fn" "$fn.tmp"; then
echo "Unchanged: $fn"
rm "$fn.tmp"
else
echo "Changed: $fn"
mv "$fn.tmp" "$fn"
fi
done