| 1 | #!/bin/bash |
| 2 | # This is a script for viewing files, invoked by AGiliTy |
| 3 | # |
| 4 | # Customize as needed for your platform and preferred graphics file viewers |
| 5 | # |
| 6 | # For X-windows, it uses xv and xanim. |
| 7 | # If X-Windows isn't running, it uses flip and zgv. |
| 8 | # AFAIK all of these programs can all be found at sunsite. |
| 9 | # |
| 10 | # If any of these send anything to stderr, they may confuse |
| 11 | # AGiliTy's screen routines (Ctrl-L should put everything right). |
| 12 | # AGiliTy doesn't redirect stderr because some svgalib programs won't |
| 13 | # run correctly if stderr doesn't point at a "real" screen. |
| 14 | # |
| 15 | # One problem is that some viewers use file name extensions to identify |
| 16 | # file type, and AGT uses nonstandard extensions for PCX files. |
| 17 | # (".P06", ".P13", ".P16", etc.) |
| 18 | # |
| 19 | |
| 20 | if [ "$DISPLAY" = "" ]; then |
| 21 | # Put your non-X PCX file viewer here, if you have one. |
| 22 | # It has to be able to run with stdout redirected, though |
| 23 | case $1 in |
| 24 | *.fl[ic] ) flip $1;; |
| 25 | *.pcx ) grav $1;; |
| 26 | *.p[0-9][0-9]) # Alternative PCX file names |
| 27 | # This is not as careful as it should be |
| 28 | tmpname=/tmp/agilpict-$PPID-$RANDOM.pcx |
| 29 | ln -s $PWD/$1 $tmpname |
| 30 | grav $tmpname |
| 31 | rm $tmpname;; |
| 32 | ## echo "PCX files not supported.";; |
| 33 | * ) zgv $1;; |
| 34 | esac |
| 35 | else |
| 36 | # You can replace the next line with the X-windows viewer of your choice. |
| 37 | case $1 in |
| 38 | *.fl[ic] ) xanim $1 2>/dev/null &;; |
| 39 | * ) xv $1 2>/dev/null &;; |
| 40 | esac |
| 41 | fi |
| 42 |