the Fink project is an effort to port
popular Unix programs to Mac OS X
Package: urlview
Version: 0.9
Revision: 1015
Description: Extracts URLs from text
License: GPL
Maintainer: Brendan Cully
BuildDepends: libncurses5 (>= 5.4-20041023-1006), fink (>= 0.24.12)
Depends: ncurses (>= 5.4-20041023-1006), libncurses5-shlibs (>= 5.4-20041023-1006)
Suggests: mutt
Source: ftp://ftp.mutt.org/mutt/contrib/urlview-%v.tar.gz
Source-MD5: 67731f73e69297ffd106b65c8aebb2ab
PatchFile: %n.patch
PatchFile-MD5: ba3970ef9115703506c2a2c59ff3432a
PatchScript: sed 's|@PREFIX@|%p|g' <%{PatchFile} | patch -p1
ConfigureParams: --sysconfdir=%p/etc/urlview --mandir=%i/share/man
ConfFiles: %p/etc/%n/system.urlview %p/etc/%n/url_handler.sh
InstallScript: <<
# the install-man target is a busted hand-rolled one.
mkdir -p %i/share/man/man1
make install DESTDIR=%d
mkdir -p %i/share/doc/%n/examples
install -m 644 sample.urlview %i/share/doc/%n/examples
install -m 644 text %i/share/doc/%n/examples
mkdir -p %i/share/doc/%n/html
install -m 644 %n.html %i/share/doc/%n/html
mkdir -p %i/etc/%n
install -m 644 system.urlview %i/etc/%n
install -m 644 url_handler.sh.fink %i/etc/%n/url_handler.sh
<<
DocFiles: AUTHORS README COPYING ChangeLog urlview.sgml
DescDetail: <<
This utility is used to extract URL from text files, especially from
mail messages in order to launch some browser to view them. This used
to be a part of mutt but has now become an independent tool
<<
DescUsage: <<
It compiles and runs fine, but requires additional customization to
call your preferred browser. See the docs and modify the url_handler.sh
script as necessary (at least until the package is update with sensible
defaults...).
<<
Homepage: http://www.mutt.org
urlview patches urlview - URL extractor/launcher urlview <filename> [ <filename> ... ] urlview is a screen oriented program for extracting URLs from text urlview attempts to read ~/.urlview upon startup. REGEXP <regular expression to use for URL matching> urlview uses a regular expression to extract URLs from the specified
diff --git a/system.urlview b/system.urlview
new file mode 100644
--- /dev/null
+++ b/system.urlview
@@ -0,0 +1,10 @@
+#
+# Sample urlview(1) configuration file
+#
+
+# regular expression to use to match URLs
+REGEXP (((http|https|ftp|gopher)|mailto):(//)?[^ <>"\t]*|www\.[-a-z0-9.]+)[^ .,;\t<">\):]
+
+# command to invoke for selected URL
+COMMAND /etc/urlview/url_handler.sh
+
diff --git a/url_handler.sh.fink b/url_handler.sh.fink
new file mode 100644
--- /dev/null
+++ b/url_handler.sh.fink
@@ -0,0 +1,120 @@
+#! /bin/bash
+
+# Copyright (c) 1998 Martin Schulze
+# Slightly modified by Luis Francisco Gonzalez
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+###########################################################################
+# Configurable section
+###########################################################################
+#
+# Any entry in the lists of programs that urlview handler will try out will
+# be made of /path/to/program + ':' + TAG where TAG is one of
+# XW: XWindows program
+# XT: Launch with an xterm if possible or as VT if not
+# VT: Launch in the same terminal
+
+# The lists of programs to be executed are
+https_prgs="/usr/X11R6/bin/netscape:XW /usr/bin/lynx:XT"
+http_prgs="/usr/bin/lynx:XT /usr/X11R6/bin/netscape:XW"
+mailto_prgs="/usr/bin/mutt:VT /usr/bin/elm:VT /usr/bin/pine:VT /usr/bin/mail:VT"
+gopher_prgs="/usr/bin/lynx:XT /usr/bin/gopher:XT"
+ftp_prgs="/usr/bin/lynx:XT /usr/bin/ncftp:XT"
+
+# Program used as an xterm (if it doesn't support -T you'll need to change
+# the command line in getprg)
+XTERM=/usr/X11R6/bin/xterm
+
+
+###########################################################################
+# Change bellow this at your own risk
+###########################################################################
+function getprg()
+{
+ local ele tag prog
+
+ for ele in $*
+ do
+ tag=${ele##*:}
+ prog=${ele%%:*}
+ if [ -x $prog ]; then
+ case $tag in
+ XW)
+ [ -n "$DISPLAY" ] && echo "X:$prog" && return 0
+ ;;
+ XT)
+ [ -n "$DISPLAY" ] && [ -x "$XTERM" ] && \
+ echo "X:$XTERM -e $prog" && return 0
+ echo "$prog" && return 0
+ ;;
+ VT)
+ echo "$prog" && return 0
+ ;;
+ esac
+ fi
+ done
+}
+
+url="$1"; shift
+
+type="${url%%:*}"
+
+if [ "$url" = "$type" ]; then
+ type="${url%%.*}"
+ case "$type" in
+ www|web)
+ type=http
+ ;;
+ esac
+ url="$type://$url"
+fi
+
+case $type in
+https)
+ prg=`getprg $https_prgs`
+ ;;
+http)
+ prg=`getprg $http_prgs`
+ ;;
+ftp)
+ prg=`getprg $ftp_prgs`
+ ;;
+mailto)
+ prg=`getprg $mailto_prgs`
+ url="${url#mailto:}"
+ ;;
+gopher)
+ prg=`getprg $gopher_prgs`
+ ;;
+*)
+ echo "Unknown URL type. Please report URL and viewer to:"
+ echo "joey@debian.org."
+ /bin/echo "Press enter to continue.\c"; read x
+ exit
+ ;;
+esac
+
+if [ -n "$prg" ]; then
+ if [ "${prg%:*}" = "X" ]; then
+ ${prg#*:} "$url" 2>/dev/null &
+ else
+ $prg "$url"
+ fi
+fi
+
+
+
+
diff --git a/urlview.c b/urlview.c
--- a/urlview.c
+++ b/urlview.c
@@ -48,7 +48,7 @@
#define DEFAULT_REGEXP "(((https?|ftp|gopher)://|(mailto|file|news):)[^' \t<>\"]+|(www|web|w3)\\.[-a-z0-9.]+)[^' \t.,;<>\"\\):]"
#define DEFAULT_COMMAND "url_handler.sh %s"
-#define SYSTEM_INITFILE "/etc/urlview.conf"
+#define SYSTEM_INITFILE "@PREFIX@/etc/urlview.conf"
#define OFFSET 2
#define PAGELEN (LINES - 1 - OFFSET)
@@ -506,10 +506,11 @@
free (url[current]);
url[current] = strdup (buf);
endwin ();
+ quote (scratch, sizeof (scratch), url[current]);
if (strstr (command, "%s"))
- snprintf (buf, sizeof (buf), command, quote (scratch, sizeof (scratch), url[current]));
+ snprintf (buf, sizeof (buf), command, scratch);
else
- snprintf (buf, sizeof (buf), "%s %s", command, quote (scratch, sizeof (scratch), url[current]));
+ snprintf (buf, sizeof (buf), "%s %s", command, scratch);
printf ("Executing: %s...\n", buf);
fflush (stdout);
system (buf);
diff --git a/urlview.html b/urlview.html
new file mode 100644
--- /dev/null
+++ b/urlview.html
@@ -0,0 +1,90 @@
+
+
+
+0.1 NAME
+
+
+
+
+0.2 SYNOPSIS
+
+
+
+
+0.3 DESCRIPTION
+
+
+
+files and displaying a menu from which you may launch a command to view a
+specific item.
+
+0.4 CONFIGURATION
+
+
+
+If this file doesn't exist, it will try to read a system wide file
+in /etc/urlview/system.urlview. There are
+two configuration commands (order does not matter):
+
+
+
+text files. \r, \t, \n and \f are all converted to
+their normal printf(2) meanings. The default REGEXP is
+
+
+(((https?|ftp|gopher)://|(mailto|file|news):)[^' \t<>"]+|(www|web|w3)\.[-a-z0-9.]+)[^' \t.,;<>"\):]
+
+
COMMAND <command to launch with URL>
If the specified command contains a ``%s'', it will be subsituted
+with the URL that was requested, otherwise the URL is appended to the
+COMMAND string. The default COMMAND is
+
+ url_handler.sh '%s'
+
+ Netscape -remote 'openURL(%s)'
+
[⁁'...] in the default REGEXP)
+ X-Nasty-Url: http://www.`program_to_execute_as_you`.com
+
+
system-wide urlview configuration file
urlview configuration file
regcomp(3)
Michael Elkins <me@cs.hmc.edu>.
+Modified for Debian by Luis Francisco Gonzalez <luisgh@debian.org>.
+Modified for SuSE by Dr. Werner Fink <werner@suse.de> and Stepan Kasal <kasal@suse.cz>.
˜/.urlview upon startup.
If this file doesn't exist, it will try to read a system wide file
-in /etc/urlview.conf. There are
+in /@PREFIX@etc/urlview.conf. There are
two configuration commands (order does not matter):
REGEXP <regular expression to use for URL matching>
@@ -62,7 +62,7 @@
-/etc/urlview.conf
+@PREFIX@/etc/urlview.conf
system-wide urlview configuration file
urlview _unstable_ port .patch