#!/usr/local/bin/gdperl
#
#
# gee - gopher environment editor (Version 1.0)
# usage:
# gee [-t toplevel] [-p port] [-l default_linkfile_name] [-g dirname_file]
# Use the -t option to specify toplevel directory
# Use the -p option to specify default port
# Use the -l option to specify default link file name
# Use the -g option to reindex the heirarchy's directories
#
# copyright (c) Bill Middleton, 1993  All rights reserved
# [email protected]
#
#      Absolutely No Warranty expressed or implied.  Use with care.
#      Freely redistributable under the same terms as perl.
#      Send comments, suggestions, and fixes to me please.
#
#
# Initial improvements suggested by Randy Bush, [email protected]
# More help from [email protected], and [email protected].
# Many thanks to these and others who have sent commentary.
# To get on the discussion list, drop me a line here at feenix.
#
# RCS'ed by moose to keep track of things
$RCSID = '$Id: gee,v 3.4 93/09/28 23:44:03 wjm Exp $';
#
# $Log: gee,v $
# Revision 3.4.1.1  93/09/29  03:12:51  03:12:51  wjm (Bill Middleton)
# Last checkin before announcement to the mailing list.  One slight
# modification to the prompt change mentioned in 3.4, to make it
# agree with the actual number of items in the cwd.
#
# Revision 3.4  93/09/29  02:48:26  02:48:26  wjm (Bill Middleton)
# Major fix to the directory selection routine, select_dir().  Reworked
# most of moose's fixes to round out the routine nicely.  Added a
# reference to the main prompt, to the current item number, of the total items
# in the cwd.
#
# Revision 3.3  93/09/27  02:03:14  02:03:14  wjm (Bill Middleton)
# small bug in parsef which didnt display correct path on remote
# links.  fixed.
#
# Revision 3.2.2.2  93/09/27  01:28:03  01:28:03  wjm (Bill Middleton)
# Fixed up file installation to allow the current .cap or .link to
# be installed along with the file.  If neither exists yet, then
# allow creation of one.  Deletion of files requires system() without
# a list, apparantly because of the argument to rm.  Fixed.
#
# Revision 3.2.2.1  93/09/26  15:21:23  15:21:23  wjm (Bill Middleton)
# Fixed nasty little bug getting the type of the item
#
# Revision 3.2.1.2  93/09/25  03:31:57  03:31:57  wjm (Bill Middleton)
# added a little more checking to mv'ing, copying, or linking files to other
# directories. Stripped out the descriptor creation code and made it a
# subroutine.  Fixed most of the system() calls to use a list.
#
# Revision 3.2.1.1  93/09/24  20:43:01  20:43:01  wjm (Bill Middleton)
# Many bugs fixed, and features/options refined.  Several new configuration
# variables added to deal with gdbm, link entry delimitation, and parsing the
# gopherd.conf file.  Most of moose's changes left intact, or slightly altered.
# Indentation via tabs removed, however.   Resolution of link file name for
# file/dir in cwd fixed.  Otherwise full path displayed.  Fixed nuke_cache()
# to get .cache+ files too.
#
# Revision 3.2  93/09/10  13:04:46  13:04:46  wjm (Bill Middleton)
# Checked in as 3.2 from 3.1.1.7
#
# Revision 3.1.1.7  93/08/26  20:44:03  moose
# Implemented simple data entry. Changed subs delete_file and mv_file
# so .cap files got the same treatment as the regular file.
# Also changed redisplay features of view_lead and related code.
#
# Revision 3.1.1.6  93/08/25  18:07:48  moose
# Made calls to editor prepend full path name, quoted so that
# filenames with spaces was kept as one argument.
#
# Revision 3.1.1.5  93/08/19  12:17:58  moose
# merged most edits from 3.1.1.4.1.1, especially the parts
# that got commented at last 8^)
#
# Revision 3.1.1.4  93/08/18  16:22:55  moose
# stomped bugs in select_dir: no more paging past start or end,
# no hardcoded pagelengths, no 17 lines "End of listing ..."
#
# Revision 3.1.1.3  93/08/18  14:41:34  moose
# stomped link file parsing bug (entries with same path hides each other,
# multiple comment lines yielding bogus null entries)
#
# Revision 3.1.1.2  93/08/17  18:50:50  moose
# solved `hostname` problem (chop trailing \n 8^)
#
# Revision 3.1.1.1  93/08/17  17:54:49  moose
# merged 2.2.1.4 with 3.1, one issue remains to be solved.
# Also select dir (new 3.1 code) has problems.
#
# Revision 3.1  93/08/17  14:00:22  wjm
# I've done some more work on the Gopher Environment Editor.  It needs some
# testing tho.  I feel pretty good about it, but i wanted to get some testing
# before i make it the new default.
# Heres a short summary of the fixes:
# Now using dbm file for getdirs, and the getdirs code is builtin.
# View info for an item now loops until <CR> or change info.
# Directory selection continues until selection or [Qq].
# Add John's patch, in the form of a call to getopt.pl, to allow command
# line parameters for port, toplevel, default link file name, and the
# name of the directory-name database.
# Shorten some command lines when necessary.  (path too long)
# Added an option to not view dot-files.
#
# Revision 2.2.1.4  93/08/13  20:29:14  moose
# make read_links parse all link file entries (link file syntax
# deduced from gopherd sources: comments are lines starting with a '#'
# and link entries are separated by comments.
#
# Revision 2.2.1.3  93/08/12  22:32:32  moose
# Find, read & parse gopherd.conf, ignore suffixes, set types, hostalias.
# Hostname equality comparison now recognizes aliases as equal.
#
# Revision 2.2.1.2  93/08/12  16:57:05  moose
# Directorys sorted the same order as gopher (sub bygroup).
# Don't show dotfiles, '..' or '.'. Since '..' can't be
# selected if it isn't shown, U is added as "select parent dir".
#
# Revision 2.2.1.1  93/08/10  22:50:52  moose
# create branch for my own hacks
#
# Revision 2.2  93/08/10  17:30:09  wjm
# First round tidying up indentation.
#
#