#! /usr/local/bin/perl ##---------------------------------------------------------------------------## ## File: ## makehomeidx ## Author: ## Earl Hood ehood@convex.com ## Description: ## makehomeidx searches all entries /etc/passwd and creates a home page ## index for a Web server of all users who have defined a home page ## in their public HTML directory. ##---------------------------------------------------------------------------## ## Copyright (C) 1994 Earl Hood, ehood@convex.com ## ## 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., 675 Mass Ave, Cambridge, MA 02139, USA. ##---------------------------------------------------------------------------## require "newgetopt.pl" || die "Unable to require newgetopt.pl\n"; ## Store name of program ## ($PROG = $0) =~ s/.*\///; $VERSION = '1.1.1'; %includes = (); %excludes = (); ## Get command-line options ## &Usage() unless &NGetOpt( "excfile=s", # Exclude file "footer=s", # Filename of footer text for home page index "header=s", # Filename of header text for home page index "hostname=s", # Hostname of machine "idxrc=s", # Name of indiv resource file "incfile=s", # Include file "passwd=s", # Password file to use "pubhtml=s", # Public html directory "title=s", # Title of home page index "help" ); &Usage() if defined($opt_help); &Usage("No destination file") if $#ARGV < 0; &read_excfile($opt_excfile) if $opt_excfile; &read_incfile($opt_incfile) if $opt_incfile; ## Initialize variables ## open(HOMEIDX, "> $ARGV[0]") || die "Unable to create $ARGV[0]\n"; $H1 = ($opt_title ? $opt_title : "Home Pages"); ($TITLE = $H1) =~ s/<[^>]*>//g; $HEADER = ""; if ($opt_header) { if (open(HEADER, "$opt_header")) { while (
) { $HEADER .= $_; } } else { warn "Unable to open $opt_header\n"; } } $FOOTER = ""; if ($opt_footer) { if (open(FOOTER, "$opt_footer")) { while (