diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2008-12-12 01:05:01 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2008-12-12 01:05:01 -0500 |
commit | 5bbfb76d074c9acc27ac789ff721a5ebd609a55f (patch) | |
tree | 39dc3448df2d08bc2fbd549477843668037d1b3c /samples/keepviewer | |
parent | fe7fe1904f61ce9b03d28f34640687d887cca01c (diff) | |
download | lynx-snapshots-5bbfb76d074c9acc27ac789ff721a5ebd609a55f.tar.gz |
snapshot of project "lynx", label v2-8-7dev_10d
Diffstat (limited to 'samples/keepviewer')
-rwxr-xr-x | samples/keepviewer | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/samples/keepviewer b/samples/keepviewer new file mode 100755 index 00000000..f5c0b2c1 --- /dev/null +++ b/samples/keepviewer @@ -0,0 +1,20 @@ +#!/bin/sh +# This script can be invoked as a wrapper for an external viewer by lynx, e.g., +# given this line in lynx.cfg +# XLOADIMAGE_COMMAND:keepviewer xli %s & +# it will invoke xli on a hardlink to the file (which is assumed to be in the +# temporary directory created by lynx), and clean up when the viewer exits. +# +# Parameters: +# $1 is viewer +# $2 is filename +if test $# = 2 ; then + chmod 600 $2 + myfile=`echo $2 | sed -e 's@\(.*/tmp/\)\([^/]*/\)\?\(.*\)@\1my\3@'` + ln $2 $myfile || exit 1 + trap "rm -f $myfile" 0 1 2 5 15 + eval $1 $myfile +else + echo "Usage: keepviewer <viewer> <filename>" + exit 1 +fi |