}
$LOCAL_HOST= lc($LOCAL_HOST) ;
# If no $DOCUMENT_ROOT, try to guess it from $HOME, username, $USER_DIR.
unless (length($DOCUMENT_ROOT)) {
my($home) ;
unless ($home= $ENV{'HOME'}) {
my($uname)= getpwuid($<) || $ENV{'USER'} || `whoami` || `id -un` ;
chomp($uname) ;
&read_home_dirs unless %home_dir ; # only read when needed
$home= $home_dir{$uname} ;
}
$DOCUMENT_ROOT= "$home/$USER_DIR" ;
die "Could not determine DOCUMENT_ROOT; edit the $0 script to set it.\n"
unless (-d $DOCUMENT_ROOT) ;
print STDERR "DOCUMENT_ROOT set to \"$DOCUMENT_ROOT\"\n" ;
}
$DOCUMENT_ROOT=~ s#/$## ;
# Allows &filename_to_url() to unalias as best as possible. Note that
# use of &filename_to_url() can be avoided by the user; see note in
# that routine.
%UN_ALIAS= (reverse (%ALIAS, %SCRIPT_ALIAS) ) ;
# These are to compare equivalency to later, in &filename_to_url().
($DOC_ROOT_DEV, $DOC_ROOT_INODE)= stat("$DOCUMENT_ROOT/.") ;
$DOC_ROOT_EXISTS= -e _ ;
# Set CWD from shell variable, else from `pwd`.
$CWD= $ENV{'PWD'} || `pwd` || die "couldn't run pwd: $!" ;
chomp($CWD) ;
# These are used by &extract_urls().
# This is a complete list of URL-type attributes defined in HTML 4.0,
# plus any others I found, like nonstandard ones or from an earlier HTML.
# Only a few of these are commonly used, as of early 1998.
# The set in %html_urls could possibly link to HTML resources, while the
# set in %non_html_urls could not. The %special(.*) sets, here for
# reference only, include URL attributes that require special handling.
%html_urls= ( 'a' => [ 'href' ],
'area' => [ 'href' ],
'frame' => [ 'src', 'longdesc' ],
'link' => [ 'href', 'urn' ],
'img' => [ 'longdesc', 'usemap' ],
'q' => [ 'cite' ],
'blockquote' => [ 'cite' ],
'ins' => [ 'cite' ],
'del' => [ 'cite' ],
'object' => [ 'usemap' ],
'input' => [ 'usemap' ],
'iframe' => [ 'src', 'longdesc' ],
'ilayer' => [ 'src' ],
'layer' => [ 'src' ],
'fig' => [ 'imagemap' ],
'overlay' => [ 'imagemap' ],
'meta' => [ 'url' ],
'note' => [ 'src' ],
) ;
%non_html_urls= ( 'body' => [ 'background' ],
'img' => [ 'src', 'lowsrc', 'dynsrc' ],
'input' => [ 'src' ],
'script' => [ 'src', 'for' ],
'fig' => [ 'src' ],
'overlay' => [ 'src' ],
'select' => [ 'src' ],
'ul' => [ 'src' ],
'h1' => [ 'src' ],
'h2' => [ 'src' ],
'h3' => [ 'src' ],
'h4' => [ 'src' ],
'h5' => [ 'src' ],
'h6' => [ 'src' ],
'hr' => [ 'src' ],
'table' => [ 'src' ],
'td' => [ 'src' ],
'th' => [ 'src' ],
'tr' => [ 'src' ],
'bgsound' => [ 'src' ],
'embed' => [ 'src' ],
) ;
# %special_urls= ( 'base' => [ 'href' ] ) ;
#
# %special_html_urls= ( 'object' => [ 'codebase', 'data' ] ) ;
#
# %special_non_html_urls=
# ( 'head' => [ 'profile' ],
# 'object' => [ 'codebase', 'archive', 'classid' ],
# 'applet' => [ 'codebase', 'code', 'object', 'archive' ],
# 'form' => [ 'action', 'script' ]
# ) ;
=5= |