Page 1 of 1

gtkDialog3 script tester. Works, needs further development.

Posted: Thu 18 Mar 2010, 05:32
by sunburnt
I wrote this "gtkdialog.tester" that scans to see if there`s ending Tags for every starting Tag.
I think I got most of the tags, tell me if I missed any. Also it could do more... Suggestions?

Code: Select all

#!/bin/sh
#####		Test gtkDialog file for errors.
N=0
FILE=`Xdialog --stdout --title "  Select gtkDialog file." --fselect /mnt/home/apps/driveman 0 0`
[ $? -gt 0 ]&& exit
rm -f /tmp/gtk-test.results ; GTK=$(<$FILE)

for TAG in vbox hbox pix note list edit text tree menu label input entry radio check table frame combo width height action button window variable progress @
do																															#####		Read the entire file each loop looking for the Tag.
	[ $TAG = '@' ]&& break
	PLUS=`echo "$GTK" |grep -o '<'$TAG | wc -w`																				# count starting tags
	MINUS=`echo "$GTK" |grep -o '</'$TAG | wc -w`																		# count ending tags
	N=$(($PLUS - $MINUS)) ; [ $N -eq 0 ]&& continue															# if count = 0, next loop
	errTAG='' ; [ $N -gt 0 ]&& errTAG='/' ; N=`echo $N |sed 's/^-//'`					# fix ending tag display
	echo "    ###   $errTAG$TAG = $N" >> /tmp/gtk-test.results
done
[ ! -e /tmp/gtk-test.results ]&& echo "    ###   NO Tag problems found.  ###" > /tmp/gtk-test.results		# no errors msg.
xmessage -title "  gtkDialog Test" "
    $FILE    

    ( Tag Type ) = ( Number Missing )    

`cat /tmp/gtk-test.results`
	" &