File: keepviewer

package info (click to toggle)
lynx 2.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,024 kB
  • sloc: ansic: 137,142; sh: 4,022; perl: 1,523; makefile: 1,193; yacc: 783
file content (20 lines) | stat: -rwxr-xr-x 606 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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