home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / arraysvcs.idb / usr / lib / array / alaunch.z / alaunch
Encoding:
Korn shell script  |  1997-02-07  |  1.4 KB  |  81 lines

  1. #!/bin/ksh
  2. #
  3. # Simple script to assist "aview" with launching programs.
  4. # Sending all aview launch requests through this single script makes it
  5. # easier to add new launchable programs without requiring old arrayd.conf
  6. # files to be modified.
  7. #
  8.  
  9. Usage="Usage: $0 <origin> <app> <display> [<arg>]..."
  10.  
  11. #
  12. # Make sure enough args were specified
  13. #
  14. if [ "$#" -lt 3 ]; then
  15.     echo "Incorrect number of arguments to $0"
  16.     echo $Usage
  17.     exit 1
  18. fi
  19.  
  20. #
  21. # Give the arguments more meaningful names
  22. #
  23. Origin=$1
  24. App=$2
  25. Display=$3
  26. shift 3
  27.  
  28. #
  29. # Set up the display to use
  30. #
  31. if [ "$Display" = ":0"  -o  "$Display" = ":0.0" ]; then
  32.     if [ "$Origin" != "localhost" ]; then
  33.         Display="$Origin:0"
  34.     fi
  35. fi
  36.  
  37. #
  38. # Determine the actual program to be launched
  39. #
  40. case $App in
  41.     shell)
  42.     Program="/usr/lib/array/ashell"
  43.     ;;
  44.  
  45.     mpi )
  46.     Program="/usr/lib/array/ampi"
  47.     ;;
  48.  
  49.     pvm )
  50.     Program="/usr/lib/array/apvm"
  51.     ;;
  52.  
  53.     * )
  54.     /usr/bin/X11/xconfirm    -c                \
  55.                 -display $Display        \
  56.                 -header  "ArrayView launch"    \
  57.                 -icon    error            \
  58.                 -t "Sorry, $App is not a known application" \
  59.                 > /dev/null
  60.     exit 1
  61.     ;;
  62. esac
  63.  
  64. #
  65. # Make sure the desired application is available
  66. #
  67. if [ ! -x $Program ]; then
  68.     /usr/bin/X11/xconfirm    -c            \
  69.                 -display $Display    \
  70.                 -header  "Launch $App"    \
  71.                 -icon    error        \
  72.                 -t "Sorry, the ArrayView $App launcher $Program is not available"                    \
  73.                 > /dev/null
  74.     exit 1
  75. fi
  76.  
  77. #
  78. # Launch the application
  79. #
  80. exec $Program $Origin $Display "$@"
  81.