[MPlayer-dev-eng] [PATCH] simplify TOOLS/checktree and add charset validation
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Apr 11 11:43:20 CEST 2006
Hi,
attached patch adds $subject. Comments?
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: TOOLS/checktree.sh
===================================================================
RCS file: /cvsroot/mplayer/main/TOOLS/checktree.sh,v
retrieving revision 1.3
diff -u -r1.3 checktree.sh
--- TOOLS/checktree.sh 7 Dec 2005 18:11:58 -0000 1.3
+++ TOOLS/checktree.sh 11 Apr 2006 09:41:59 -0000
@@ -22,6 +22,7 @@
_trailws=no
_rcsid=no
_oll=no
+_charset=no
_showcont=no
_color=yes
@@ -46,6 +47,7 @@
_trailws=yes
_rcsid=yes
_oll=yes
+ _charset=yes
}
disable_all_tests() {
@@ -55,6 +57,7 @@
_trailws=no
_rcsid=no
_oll=no
+ _charset=no
}
printoption() {
@@ -101,6 +104,7 @@
printoption "trailws " "test for trailing whitespace" "$_trailws"
printoption "rcsid " "test for missing RCS Id's" "$_rcsid"
printoption "oll " "test for overly long lines" "$_oll"
+ printoption "charset " "test for wrong charset" "$_charset"
echo
printoption "all " "enable all tests" "no"
echo
@@ -115,6 +119,12 @@
echo -e "If there are, -(no)cvs has no effect.\n"
exit
;;
+ -charset)
+ _charset=yes
+ ;;
+ -nocharset)
+ _charset=no
+ ;;
-oll)
_oll=yes
;;
@@ -210,6 +220,14 @@
filelist=`all_filenames`
+if [ "$_showcont" == "yes" ]; then
+ _diffopts="-u"
+ _grepopts="-n -I"
+else
+ _diffopts="-q"
+ _grepopts="-l -I"
+fi
+
# -----------------------------------------------------------------------------
# DO CHECKS
@@ -232,22 +250,14 @@
if [ "$_crlf" == "yes" ]; then
printhead "checking for MSDOS line endings ..."
- if [ "$_showcont" == "yes" ]; then
- grep -n -I "
" $filelist
- else
- grep -l -I "
" $filelist
- fi
+ grep $_grepopts "
" $filelist
fi
# -----------------------------------------------------------------------------
if [ "$_trailws" == "yes" ]; then
printhead "checking for trailing whitespace ..."
- if [ "$_showcont" == "yes" ]; then
- grep -n -I "[[:space:]]\+$" $filelist
- else
- grep -l -I "[[:space:]]\+$" $filelist
- fi
+ grep $_grepopts "[[:space:]]\+$" $filelist
fi
# -----------------------------------------------------------------------------
@@ -261,11 +271,24 @@
if [ "$_oll" == "yes" ]; then
printhead "checking for overly long lines (over 79 characters) ..."
- if [ "$_showcont" == "yes" ]; then
- grep -n -I "^[[:print:]]\{80,\}$" $filelist
- else
- grep -l -I "^[[:print:]]\{80,\}$" $filelist
- fi
+ grep $_grepopts "^[[:print:]]\{80,\}$" $filelist
+fi
+
+# -----------------------------------------------------------------------------
+
+if [ "$_charset" == "yes" ]; then
+ printhead "checking bad charsets ..."
+ for I in $filelist ; do
+ case "$I" in
+ ./help/help_mp-*.h)
+ ;;
+ ./DOCS/*)
+ ;;
+ *.c|*.h)
+ iconv -c -f ascii -t ascii "$I" | diff $_diffopts "$I" -
+ ;;
+ esac
+ done
fi
# -----------------------------------------------------------------------------
More information about the MPlayer-dev-eng
mailing list