Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 39508bca118eac611638471b39505795 > files > 5

why-2.31-6.fc18.src.rpm

--- bin/gwhy.sh.orig	2012-07-19 12:33:10.000000000 -0600
+++ bin/gwhy.sh	2012-07-30 20:23:41.708914796 -0600
@@ -1,11 +1,17 @@
 #!/bin/sh
 
-case $1 in
+if ! test $1; then
+file=`zenity --file-selection --title="Select the file you want to open with gwhy"`;
+else
+file=$1
+fi
+
+case $file in
   *.java)
-	b=`basename $1 .java`
-	krakatoa -gen-only $1 || exit 1
+	b=`basename $file .java`
+	krakatoa -gen-only $file || exit 1
 	echo "krakatoa on $b.java done"
-        d=`dirname $1`
+        d=`dirname $file`
         echo "cd $d"
         cd $d
 	jessie -locs $b.jloc -why-opt -split-user-conj $b.jc || exit 2
@@ -13,20 +19,23 @@
 	make -f $b.makefile gui
 	;;
   *.c)
-	b=`basename $1 .c`
-	caduceus -why-opt -split-user-conj $1 || exit 1
+	b=`basename $file .c`
+	caduceus -why-opt -split-user-conj $file || exit 1
 	make -f $b.makefile gui
 	;;
   *.jc)
-	b=`basename $1 .jc`
+	b=`basename $file .jc`
 	jessie -why-opt -split-user-conj $b.jc || exit 1
 	make -f $b.makefile gui
 	;;
   *.mlw|*.why)
-	gwhy-bin -split-user-conj $1
+	gwhy-bin -split-user-conj $file
+	;;
+  ?*)
+	echo "$file does not have file type extension recognized by gwhy"
 	;;
   *)
-	echo "don't know what to do with $1"
+	echo "gwhy needs the name of a file to inspect in order to run"
 esac