:
#ident "@(#)/usr/local/autoftpmake 1.0 11/06/90" Author: Milton Turner
# Office: HQ ATC/SCDAA, Randolph AFB, Texas 78150
# Phone: AV 487-UNIX (8649)  Comm: (512) 652-UNIX (8649)
#
#help# This script is designed to make an autoftp get spec. file from a
#help# index file from SIMTEL-20 repository.  It takes the filename and
#help# file type and makes a get file for autoftp gets on the programs.
#help# Provide this script with a filename that is an 00-INDEX.TXT file
#help# from SIMTEL-20 Archive directory, and the result is a file that
#help# can be fed into the autoftp script and function as a getfile.
#help# Subsequent files made like this can be appended (with no blank lines)
#help# for continual gets while changing to the proper directory on the fly.
##############################################################################
#
# Following is the index file (00-INDEX.TXT) format from SIMTEL-20
# ----------------------------------------------------------------
#               filename 1-12,space,space (13,14)
#               filetype 15,space,space (16,17)
#               filesize 18-23,space,space (24,25)
#               filedate 26-31,space,space (32,33)  (Date in YYMMDD format)
#               filedesc 34-80
#
# following example conforms to file index character positions:
#
# filename   type  size    date    description
# ----------------------------------------------------------------
#TESTFILE.ZIP  B   14223  900826  Test files access in many modes. Good net tool
################################################################################
while :
  do
	echo "What INDEX file do you wish to use as a list to get via autoftp ? \c:"
	read file
  	   if [ "$file" = "" ]
	      then 
	   echo "\nYou must give a filename"
	      else
		cut -c1-12 $file > /usr/tmp/a.$$
		cut -c14-15 $file > /usr/tmp/b.$$
		grep "^Directory" $file | cut -d" " -f2 | sed -e "s/^/-d	/" > /usr/tmp/c.$$
		paste /usr/tmp/b.$$ /usr/tmp/a.$$ | egrep "^ B	|^ A	" >> /usr/tmp/c.$$
		cat /usr/tmp/c.$$ | sed -e "s/^ B	/-8	/" | \
		sed -e "s/^ A	/\-a	/" | sed -e "s/ //g" > /usr/tmp/d.$$
		mv /usr/tmp/d.$$ get.$file
	      break
	   fi
done
/bin/rm /usr/tmp/?.$$
echo "YOUR FILE IS NAMED get.$file and is in `pwd`/$file.DIR"
#
# Milt Specifics (use if you're brave)
# I know, this is sloppy, but it was done in 33.5 nanoseconds.

mkdir $file.DIR	# Now create a retrieve directory for STUF in $file
cp aftp $file.DIR		# aftp is the autoftp for simtel20
mv get.$file $file.DIR	# now put all needed things in $file.DIR

