#!/bin/sh # ---------------------------------------------------------------------- # PROGRAM: guib # USAGE: guib module-file # PURPOSE: tries to be a simple GUI based on module definition file # ---------------------------------------------------------------------- # Anton Kokalj # Jozef Stefan Institute, Ljubljana, Slovenia # INFM DEMOCRITOS National Simulation Center, Trieste, Italy # Email: Tone.Kokalj@ijs.si # ====================================================================== # Copyright (c) 2002,2003 Anton Kokalj # ====================================================================== # # # This file is distributed under the terms of the GNU General Public # License. See the file `COPYING' in the root directory of the present # distribution, or http://www.gnu.org/copyleft/gpl.txt . # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL ANTON KOKALJ BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # if test "x`type readlink`" = "x"; then # no readlink cmd; make a function-substitute readlink() { echo `ls -l $1 | awk '{print $NF}'` } fi pathname() { file=`type -p $1` if test $? -gt 0; then file=`which $1` if test $? -gt 0; then # give-up file=$1 fi fi echo $file } pathdir() { file=`pathname $1` while test -h $file; do file=`readlink $file` done dir=`dirname $file` ( cd $dir; pwd ) } if test -z "$GUIB" ; then # try to guess the GUIB value export GUIB=`pathdir $0` fi if test $# -eq 1 ; then if test \( "$1" = "-v" \) -o \( "$1" = "--version" \) ; then version=`cat $GUIB/VERSION` echo $version exit 0 fi else echo " Usage: $0 GUIB-definition-file " exit 1 fi if test -d $GUIB/bin ; then echo " GUIB: using the \"$GUIB/itkwish\" interpreter " $GUIB/bin/itkwish $GUIB/guib.tcl $@ else echo " GUIB: using the system default \"tclsh\" interpreter " tclsh $GUIB/guib.tcl $@ fi