summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/lynx/samples/keepviewer
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2004-06-22 04:01:52 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2004-06-22 04:01:52 +0000
commit07f9a9d13ea0b7f12cf124c7c25c9b01c96c9369 (patch)
tree63b3492941bfdd52a92247669895596bbb90b758 /gnu/usr.bin/lynx/samples/keepviewer
parent48e173e619472dce9fa16a21cb6fb6ac6a9e3d24 (diff)
update to lynx 2.8.5rel.1
tested todd@,naddy@. millert@ deraadt@ ok
Diffstat (limited to 'gnu/usr.bin/lynx/samples/keepviewer')
-rw-r--r--gnu/usr.bin/lynx/samples/keepviewer20
1 files changed, 20 insertions, 0 deletions
diff --git a/gnu/usr.bin/lynx/samples/keepviewer b/gnu/usr.bin/lynx/samples/keepviewer
new file mode 100644
index 00000000000..f5c0b2c1703
--- /dev/null
+++ b/gnu/usr.bin/lynx/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