#!/usr/local/bin/perl -w

# $Id: xurl,v 1.14 1998/05/14 03:12:23 czyborra Exp $
# (C) 1997 Roman czyborra@cs.tu-berlin.de
# This URL extractor converts a text/plain into a text/html lookalike
# with anything looking like a URL turned into a hyperlink and then
# hands it over to lynx so the user can easily follow references.
# I use xurl as one of my (bogus) print-commands in Pine.

$protocol="(http|file|ftp|gopher|wais|news|nntp|finger|telnet)";
$urlender="][\"`'><\\s"; $punct=").,:;\?";

open (STDOUT, "|xviewer .html rxvt -e lynx");

while (<>)
{
    s~&~&amp;~g; s~<~&lt;~g; s~\n~<BR>\n~; s~\swww[.]\b~ http://www.~gi;
    s~($protocol:[^$urlender]+[^$urlender$punct])~<A HREF="$1">$1<\/A>~gi;
    print;
}

