about summary refs log tree commit diff stats
path: root/samples/keepviewer
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2001-10-06 22:20:25 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2001-10-06 22:20:25 -0400
commitf78e27712a4f44dbdf3c1532c3d1958989bf40a5 (patch)
tree51a8f8acd39f65da307ae05a0b9276490e03bedd /samples/keepviewer
parentfc99820d832c512631aa418520f5bc6a204e8b91 (diff)
downloadlynx-snapshots-f78e27712a4f44dbdf3c1532c3d1958989bf40a5.tar.gz
snapshot of project "lynx", label v2-8-5dev_3
Diffstat (limited to 'samples/keepviewer')
-rwxr-xr-xsamples/keepviewer15
1 files changed, 15 insertions, 0 deletions
diff --git a/samples/keepviewer b/samples/keepviewer
new file mode 100755
index 00000000..92e8f768
--- /dev/null
+++ b/samples/keepviewer
@@ -0,0 +1,15 @@
+#!/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
+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