[go: up one dir, main page]

File: dwww

package info (click to toggle)
dwww 1.10.3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 676 kB
  • ctags: 261
  • sloc: perl: 2,774; ansic: 1,507; makefile: 153; sh: 130
file content (56 lines) | stat: -rwxr-xr-x 1,006 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# "@(#)dwww:$Id: dwww,v 1.12 2003-07-27 16:17:32 robert Exp $"
#
# based on dpkg-www

#
# Initialization
#
. /usr/share/dwww/functions.sh || exit 1
dwww_initialize


www_browser=""
if [ -n "$DISPLAY" ] ; then
	www_browser="$DWWW_X11_BROWSER"
else
	www_browser="$DWWW_BROWSER"
fi

# $BROWSER, if set, overrides our config values
if [ -n "$BROWSER" ] ; then
	# let sensible-browser handle $BROWSER properly
	www_browser=sensible-browser
fi
	

for i in "$www_browser" sensible-browser ; do
	if test -n "$i" && command -v "$i" > /dev/null 2>&1; then
		www_browser="$i"
		break
	fi
done


if [ -z "$www_browser" ] ; then
	echo "$0: no useful browser found" 2>&1
fi

if [ -z "$DWWW_SERVERNAME" ]
then
	DWWW_SERVERNAME=localhost
fi

if [ -n "$DWWW_SERVERPORT" ]
then
	DWWW_SERVERNAME="$DWWW_SERVERNAME:$DWWW_SERVERPORT"
fi

if [ -z "$1" ]
then
	exec "$www_browser" "http://$DWWW_SERVERNAME/dwww/"
else
	uri="`urlencode $1`"
	exec "$www_browser" "http://$DWWW_SERVERNAME/cgi-bin/dwww?search=$uri"
fi