/*   View Documentation   v1.36                                 */
/*                                                              */
/*  This is a very powerful or dangerous program, basically     */
/*  it's an online Dir util.  I changed VIEWIT in my english    */
/*  file to ARCPROC (see screenshot).  This way members can     */
/*  open an archive and read docs, or download docs or lots     */
/*  of other useful things.  If your access is 31 or 32 then    */
/*  you may go anywhere on the HD you want else you are         */
/*  restricted to T:DOCREADER/.                                 */
/*                                                              */
/*                                                              */

Options Results
GetUser 45
File=result
if upper(right(file,4))~='.LHA' & upper(right(file,4))~='.LZH' then do
	Transmit 'Cannot process file...'
	exit
end
GetUser 15
access=result
VerNumber='v1.38'
speed=1

			/*								*/
minaccess=31		/*  This is the minumum access to move from dir to dir		*/
password='GATEWAY1'	/*  VERY POWERFUL, CHANGE TO 32 OR HIGHER IF NOT SURE		*/

Start:
address command 'MakeDir Ram:DocReader'
transmit '\n1\#5LHA -v9 -b32 -M -N x 'file' Ram:DocReader/\'
PathName='Ram:DocReader/'
PRAGMA(Directory,PathName)
ChangeWhere "ArcProc "||VerNumber
ChangeWhat "Scanning Archive"
address command 'Run delete Ram:TempFiles all'
maxline=15
pdepth=0

RenderHeader:
Transmit "\@2\f1[2J[30;44mArcProc "vernumber"        By Kenneth Brill (c)1993           Valhalla East Software           "
Transmit "[0;30;44m                                                                                         "
Transmit "[0;30;47mH[0;33;40m LHA T/V      [0;30;47mS[0;33;40m Size Window  [0;30;47m+[0;33;40m Root Dir        [0;30;47mQ[0;33;40m Quit       [1;30;47m3[0;33;40m Move Up"
Transmit "[0;30;47mD[0;33;40m Delete File  [0;30;47mR[0;33;40m Read File    [0;30;47mP[0;33;40m Parent Dir      [0;30;47mC[0;33;40m Copy/Move  [1;30;47m9[0;33;40m Move Down"
Transmit "[0;30;47mV[0;33;40m Version      [0;30;47mO[0;33;40m Download     [0;30;47mN[0;33;40m New Dir         [0;30;47mF[0;33;40m FileNote   [1;30;47m<RETURN>[0;33;40m Enter Dir"
Transmit "[0;30;47mU[0;33;40m Update Speed [0;30;47m?[0;33;40m Show Help    [0;30;47m#[0;33;40m Refresh Screen  [0;30;47m [0;33;40m            [1;30;47m [0;33;40m          "
Transmit "[7;1H[37;44m                                                                                         "

ReadCurrentDir:
listed=0
EN=0
top=maxline
bottom=1
where=1
Option=3
Transmit '[7;1H[0;30;44m                                                                              '
Transmit '[7;1H[1;37;44mReading Directory.......'
address command 'LIST > t:Excel_DirUtil.temp'
Transmit '[7;1H[1;37;44mSorting Directory.......'
address command 'Sort t:Excel_DirUtil.temp t:FileList'
Transmit '[7;1H[0;37;44m                        '
open('Dir','t:FileList','R')
EndFile=0
Do While EndFile=0
	EN=EN+1
	Entry=ReadLn('Dir')
	parse var Entry FName.EN '   ' FType.EN Flags.EN FDate.EN FTime.EN
	if UPPER(FType.EN)='FILES' then EN=EN-1
	if UPPER(FType.EN)='FILE' then EN=EN-1
	if UPPER(FType.EN)='DIRECTORIES' then EN=EN-1
	if UPPER(FType.EN)='DIRECTORY' then EN=EN-1
	if UPPER(right(FName.EN,4))='USED' then EN=EN-1
	if strip(left(FName.EN,1))=':' then EN=EN-1
	If Entry='' then do
		EndFile=1
		EN=EN-1
	End
end
call close('Dir')
address command 'Delete T:Filelist'
address command 'Delete t:Excel_DirUtil.temp'

RenderScreen:
Transmit '[8;1H[37;40m[0J'
Line=0
BLine=maxline
If EN<Top then do
	Top=EN
	BLine=(Top-Bottom)+1
end
do i=bottom to top
	Line=Line+1
	If Strip(FType.i)='Dir' then transmit '\@4[0;33m' 
		else transmit '\@4[0;35m'
	If FType.i='' then transmit '[31m'
        if speed=1 then Transmit '\@4['line+7';1H 'FName.i'['line+7';25H'FType.i'['line+7';35H'FDate.i'['line+7';50H'strip(FTime.i)
        if speed=2 then Transmit '\@4['line+7';1H 'FName.i'['line+7';25H'FType.i
        if speed=3 then Transmit '\@4['line+7';1H 'FName.i'['line+7';25H'FType.i'['line+7';35H'FDate.i
        if speed=4 then Transmit '\@4['line+7';1H 'FName.i'['line+7';25H'FType.i'['line+7';35H'strip(FTime.i)
        if speed=5 then Transmit '\@4['line+7';1H 'FName.i
end 
If Option=3 | option='B' then Line=1
If Option=9 | option='A' then Line=maxline

Main:
HOD=Time('H')
MOD=60*((Time('M')/60)-(trunc(time('M')/60)))
IF MOD<10 THEN MOD='0'||MOD
IF HOD<13 then MOD=MOD||' am'
IF HOD>12 then do
	HOD=HOD-12
	MOD=MOD||' pm'
END
BUFFERFLUSH
Transmit '[33;44m[2;35H'HOD':'MOD
Transmit '[7;1H[0;30;44m                                                                              '

Move:
Transmit '[1;37;40m['line+7';1H>'
BufferFlush
getchar
option=UPPER(result)
If option='###PANIC' Then signal EndIt

if option=9 | option='A' then do
	Transmit '[40m['line+7';1H '
	where=where-1
	if where=0 then where=1
	if where<bottom then do
		Bottom=Bottom-maxline
		top=bottom+(maxline-1)
		signal RenderScreen
	end
	Line=Line-1
	If Line=0 Then Line=1
	signal Move
end

if option='S' then do
	Transmit '[7;1H[0;37;44m  ([33m1[37m) 15 lines    ([33m2[37m) 30 lines'
	getchar
	temp=result
        if temp=2 then do
	 maxline=30
         signal readcurrentdir
        end
        maxline=15
        signal readcurrentdir
end

if option=3 | option='B' then do
	Transmit '['line+7';1H '
	where=where+1
	if where>EN then where=EN
	if where>Top then do
		bottom=bottom+maxline
		top=bottom+(maxline-1)
		signal RenderScreen
	end
	Line=Line+1
	If Line>BLine Then Line=BLine
	signal move
end

If option='V' then do
	if fname.where='[DELETED]' then signal readcurrentdir
	if FType.where='Dir' then signal move
	address command 'Version >T:EDU.tmp 'FName.where' FULL'
	SendString '[7;1H[37;44m'
	SendFile 'T:EDU.tmp'
	SendString '\w3'
	address command 'Delete T:EDU.tmp'
	signal main
end

if option='#' then signal renderheader

if option='O' then do
	if fname.where='[DELETED]' then signal readcurrentdir
	if FType.where='Dir' Then do
		transmit '[7;1H[37;44mCannot download directories\w2'
		signal main
	end
	address command 'Copy 'FName.where' RAM:'
	file='RAM:'FName.where
	QueryY '\@0[7;1H[33;44mDo you want this file compressed? '
	answer=upper(result)
	if answer='YES' then do
		transmit '[7;1H[37;44mCompressing file with LHA                                  '
		address command 'LHA a RAM:temp RAM:'FName.where
		address command 'Delete Ram:'FName.where
		address command 'rename RAM:temp.lha RAM:'FName.where'.LHA'
		file='RAM:'FName.where'.lha'
	end
	Transmit '[8;1H[37;40m[0J'
	MARKFILE file
	Download file
	address command 'delete 'file
	Transmit '[7;1H 
        signal renderheader                                                                                 '
end

if option='H' then do
	if fname.where='[DELETED]' then signal readcurrentdir
	Transmit '[7;1H[33;44m([37mV[33m)View   ([37mQ[33m)Quick View   ([37mT[33m)Test '
	GetChar
	Answer=upper(result)
	if answer='###PANIC' Then signal EndIt
	if upper(right(FName.where,4))='.LHA' | upper(right(FName.where,4))='.LZH' then do
		Transmit '\@0[2J[0;37;40m'
		if answer='V' then address command 'LHA >t:ExcelDirUtil.tmp v '||FName.where
		if answer='Q' then address command 'LHA >t:ExcelDirUtil.tmp vq '||FName.where
		if answer='T' then do
			address command 'copy '||FName.where||' RAM:'
			transmit '\#4LHA -M -Qa t RAM:'||FName.where||'\'
			address command 'delete ram:'FName.where
			More
			signal RenderHeader
		end
		SendFile 'T:ExcelDirUtil.tmp'
		address command 'Delete t:exceldirutil.tmp'
		More
		signal RenderHeader
	end
	signal main
end

if option='?' then do
	call docs
	signal renderheader
end

if option='U' then do
        query '[7;1H[33;44mEnter detail level (1=Most 5=Least) '
	CopyName=upper(result)
        If CopyName<1 | CopyName >5 Then Readcurrentdir
        speed=CopyName
        transmit '[7;1H[33;44m                                                                   '
        signal Readcurrentdir
end

if option='R' then do
	if fname.where='[DELETED]' then signal readcurrentdir
	If FType.where='Dir' then signal Main
	If upper(right(FName.where,5))='.INFO' then do
		Transmit '[7;1H[33;44mCannot read .INFO (ICON) files...\w2'
		MORE
		signal Main
	end
	If upper(right(FName.where,4))='.LHA' then do
		Transmit '[7;1H[33;44mCannot read .LHA (Compressed) files...\w2'
		MORE
		signal Main
	end
	If upper(right(FName.where,4))='.DMS' then do
		Transmit '[7;1H[33;44mCannot read .DMS (Compressed) files...\w2'
		MORE
		signal Main
	end
	If upper(right(FName.where,4))='.LZH' then do
		Transmit '[7;1H[33;44mCannot read .LZH (Compressed) files...\w2'
		MORE
		signal Main
	end
	If upper(right(FName.where,5))='.FONT' then do
		Transmit '[7;1H[33;44mCannot read .FONT (Font Tags) files...\w2'
		MORE
		signal Main
	end
	If upper(right(FName.where,4))='.BIN' then do
		Transmit '[7;1H[33;44mCannot read .BIN (Binary) files...\w2'
		MORE
		signal Main
	end
	If upper(right(FName.where,4))='.EXE' then do
		Transmit '[7;1H[33;44mCannot read .EXE (Executable) files...\w2'
		MORE
		signal Main
	end
	Open('File',FName.where,'R')
		Instring=readch('File',FType.where)
	Call close('File')
	address command 'COPY '||FName.where||' RAM:'
	transmit '[37;40m[1;1H[0J********************************************************'
	transmit '** Open your capture buffer to recieve this text file **'
	transmit '********************************************************[36m'
	Query '[33mPress <[37mRETURN[33m> to continue.'
	if result='###PANIC' Then signal EndIt
	Drop Instring	
	SendFile 'RAM:'||FName.Where
	address Command 'DELETE RAM:'||FName.Where
	Query '[33mPress <[37mRETURN[33m> to return to the Directory Utility.'
	signal RenderHeader
end

if option='Q' then signal endit

if c2x(option)='0D' then do
	if fname.where='[DELETED]' then signal readcurrentdir
	if strip(FType.where)='Dir' then do
		PRAGMA(Directory,FName.where)
		pdepth=pdepth+1
		signal ReadCurrentDir 
	end
	if right(upper(FName.where),4)='.LHA' | right(upper(FName.where),4)='.LZH' then do
		QueryY '[7;1H[33;44mDo you wish to move into this archive? (Y/n) '
		if upper(result)='NO' then do
			transmit '[7;1H                                                                        '
			signal move
		end
		Transmit '[2J'
		file='RAM:tempfiles/'fname.where
		address command 'MAKEDIR ram:Tempfiles'
		address command 'copy 'fname.where' RAM:tempfiles/'
		signal start
	end
end

if option='D' then do
	if fname.where='[DELETED]' then signal readcurrentdir
       if access > minaccess-1 then do
	QueryN '[7;1H[1;37;44mAre you sure? Delete 'FName.where'? (y/[33mN[37m)[36m '
	Answer=result
	If Answer='NO' then signal Main
	if strip(FType.where)='Dir' then do
		address command 'Delete '||FName.where||' all'
	end
	else do
		address command 'Delete 'FName.where
	end
	FName.where='[DELETED]'
	FType.where=''
	FDate.where=''
	FTime.where=''
	Transmit '['line+7';1H[0;31;40m [DELETED][K'
	signal move 
       end
end

if option='+' then do
	PRAGMA(Directory,PathName)
	signal ReadCurrentDir
	pdepth=0
end

if option='N' then do
      if access>minaccess-1 then do
change:
	newpath=''
	query '[7;1H[0;33;44mChange to what directory:                \<f\c7'
	NewPath=upper(result)
        if left(newpath,4)='LIST' then do
         transmit '[8;1H[J'
         transmit '\#5EVC 'right(newpath,(length(newpath)-5))' COL=3 NOFILES\'
         MORE
         listed=1
         signal change
        end
        if newpath = '' then signal endchange
	queryy '[7;1HDelete temp directory [4;5mT:DocReader[0;33;44m? '
	if upper(result)='YES' then do
         PRAGMA(Directory,"t:")
         address command 'delete Ram:DocReader all'
        end 
        pathname=newpath
	PRAGMA(Directory,PathName)
endchange:
 	if listed=1 then signal readcurrentdir
	signal ReadCurrentDir
	pdepth=1000
      end
end

if option='C' then do
	if fname.where='[DELETED]' then signal readcurrentdir
	if access>minaccess-1 then do
copy:
        Copyname=''
	query '[7;1H[0;33;44mCopy to what directory:                                    \<z\c7'
	CopyName=upper(result)
        if left(copyname,4)='LIST' then do
         transmit '[8;1H[J'
         transmit '\#5EVC 'right(copyname,(length(copyname)-5))' COL=3 NOFILES\'
         MORE
         listed=1
         signal Copy
        end
        if copyname='' then signal endcopy
	address command 'Copy 'FName.where' 'Copyname' CLONE'
	queryN '[7;1H[33;44mDelete the original? (y/N)       \<6'
	CopyName=upper(result)
	if CopyName='YES' then do
	  address command 'delete 'FName.where
	  FName.where='[DELETED]'
	  FType.where=''
	  FDate.where=''
	  FTime.where=''
	  if listed=0 then Transmit '['line+7';1H[0;31;40m [DELETED][K'
	end
endcopy:
	transmit '[7;1H[33;44m                                                          '
	if listed=1 then signal readcurrentdir
	signal Move
      end
end

if option='F' then do
	if fname.where='[DELETED]' then signal readcurrentdir
	if access>minaccess-1 then do
		query '[7;1H[33;44mEnter Filenote: '
		CopyName=upper(result)
		address command 'Filenote 'FName.where' "'Copyname'"'
		transmit '[7;1H[33;44m                                                                   '
		signal Move
	end
end

if option='P' then do
        if pdepth=0 then do
         if access>minaccess-1 then do
          Query '[7;1H[0;33;44mEnter password '
          if upper(result)=upper(password) then pdepth=1000
         end
        end
        if pdepth>0 then do
         PRAGMA(Directory,'/')
         pdepth=pdepth-1
        end
	signal ReadCurrentDir
end

signal move

EndIt:
transmit '[37;40m[2J'
Transmit '\z0\c7Deleting temp directory....'
PRAGMA(Directory,"t:")
address command 'Run delete Ram:DocReader all'
address command 'Run delete Ram:TempFiles all'
Exit

docs:
Transmit '\@0\f1\c6\n1     On-Line Archive Processor 'vernumber'        By Kenneth Brill'
Transmit '                                            GateWay Amiga BBS'
Transmit '                                            (314)-381-7504/5507\n1'
Transmit 'What does it do:'
transmit '  \c7The driving force behind the devopment of ArcProc was my lowly 2400'
transmit '  baud modem.  I needed a way to read the DOC files (and other text'
transmit '  files) from inside archives.  This allows me to look at a program'
transmit '  and know if I am interested in it BEFORE I download it.  Later as I'
transmit '  found the program more and more useful I added many new options to'
transmit '  allow me to move files, add filenotes and delete files.  These type'
transmit '  of options are of course restricted to SysOp access only.  Below is'
transmit '  a list of the commands and how they work:\n1'
transmit '  \c3Size Window\c6     This command allows you to choose either 15 or'
transmit '                  30 lines on the display for those who use an'
transmit '                  interlaced screen.'
transmit '  \c3Read File\c6       This command will display any text file.  This'
transmit '                  is the MAIN command in the program as it was the'
transmit '                  original purpose of the program.'
transmit '  \c3Delete file\c6     This is a restricted access command.  It will'
transmit '                  delete any file or directory.  It will always ask'
transmit '                  before it deletes anything.'
transmit '  \c3LHA V/T\c6         This command allows you to VIEW or TEST LHA or'
transmit '                  LZH files.'
transmit '  \c3Version\c6         This will give you the internal version number'
transmit '                  of the selected executable object.'
transmit '  \c3Show Help\c6       This displays this file.  Hopfully this is'
transmit '                  enough to teach you the program'
transmit '  \c3Update Speed\c6    This allows you to customize the display to'
transmit '                  5 different levels.  Level 1 gives you full info and'
transmit '                  is good for 14.4K connections and local, Level 5 just'
transmit '                  gives the filename and type (by color) only and is'
transmit '                  great for 2400 baud modems.'
transmit '  \c3Download\c6        This is an option to use instead of READING a'
transmit '                  text file.  Maybe the file is very large or you just'
transmit '                  want to read it later.  You will be asked if you want'
transmit '                  the file compressed.'
transmit '  \c3Root Dir\c6        This command will return you to the ROOT'
transmit '                  directory of where ever you are.'
transmit '  \c3Parent Dir\c6      This will back you out one directory in'
transmit '                  directory tree you are in.'
transmit '  \c3Change Dir\c6      This is a resricted access coammand.  It allows'
transmit '                  you to move to another directory directly.'
transmit '  \c3Enter Dir\c6       This has 2 functions.  If you press <ENTER>'
transmit '                  with a DIRECTORY selected then the program will enter'
transmit '                  that directory.  If you have a LHA or LZH file selected'
transmit '                  it will "enter" that LHA file.'
transmit '  \c3Copy/Move\c6       This will allow you to copy or move a file.  When'
transmit '                  it asks you for a directory you may type:'
transmit '                          \c7LIST <dir>\c6'
transmit '                  where <dir> is the root dir you wish to examine.'
transmit '                  This allows you to scout about before you enter'
transmit '                  a path to copy to.  Ths copy is done in CLONE mode.'
transmit '  \c3FileNote\c6        This allows you to add a filenote to the'
transmit '                  selected file.'
transmit '  \c3Quit\c6            This of course quits the program.'
MORE
return


/************************************************************************/
/* Error Handling Routines                                              */
/************************************************************************/
ioerr:
    t 'Input/Output Error in 'progname'.  Line:  'SIGL
    t 'Error:  'RCALL errortext(RC)
    t 'Please notify 'sysopname'!'
    t 'Returning to 'BBSname'...'
    LOGENTRY 'Input/Output Error in 'progname'.  Line:  'SIGL
    LOGENTRY 'Error:  'RCALL errortext(RC)
    BUFFERFLUSH
    SHUTDOWN
EXIT

syntax:
    t 'Syntax Error in 'progname'.  Line:  'SIGL
    t 'Error:  'RCALL errortext(RC)
    t 'Please notify 'sysopname'!'
    t 'Returning to 'BBSname'...'
    LOGENTRY 'Syntax Error in 'progname'.  Line:  'SIGL
    LOGENTRY 'Error:  'RCALL errortext(RC)
    BUFFERFLUSH
    SHUTDOWN
EXIT
