summaryrefslogtreecommitdiffstats
path: root/samples/keepviewer
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:37:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:37:15 +0000
commitae5d181b854d3ccb373b6bc01b4869e44ff4d87a (patch)
tree91f59efb48c56a84cc798e012fccb667b63d3fee /samples/keepviewer
parentInitial commit. (diff)
downloadlynx-ae5d181b854d3ccb373b6bc01b4869e44ff4d87a.tar.xz
lynx-ae5d181b854d3ccb373b6bc01b4869e44ff4d87a.zip
Adding upstream version 2.9.0dev.12.upstream/2.9.0dev.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'samples/keepviewer')
-rwxr-xr-xsamples/keepviewer20
1 files changed, 20 insertions, 0 deletions
diff --git a/samples/keepviewer b/samples/keepviewer
new file mode 100755
index 0000000..f5c0b2c
--- /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