home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
batnmore.z!p
/
READER.BTM
< prev
next >
Wrap
Text File
|
1992-11-15
|
2KB
|
76 lines
*REM This batch file is Freeware, free to use and redistribute unmodified *
*REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
REM Read special formatted text files via on-screen index table
REM Timestamp 15-Nov-1992
break on^setlocal^unalias *
if %#==0 .or. "%1"=="-?" goto info
if "%@ascii[%1]"=="45" .and. not exist %1 goto optiot^goto index
:optiot
set index=%@eval[%index+1]^set %@ascii[%@substr[%1,%index,1]]=1
if %index lt %@eval[%@len[%1]-1] goto optiot^shift
REM Create index file
:index
iff not exist %1 then^echo Error: Cannot find %1^goto end^endiff
Iff not exist %@name[%1].ind .or. "%[%@ascii[f]]"=="1" then
echos Creating %@upper[%@name[%1].ind] Index File...
del/q %@name[%1].ind>&nul
echo *** Exit ***>>%@name[%1].ind
for %a in (@%1) if %@ascii[%a]==58 echo %a>>%@name[%1].ind
REM Create alphabetically ordered index file
iff "%[%@ascii[a]]"=="1" then
iff "%@search[sort]" != "" then
type %@name[%1].ind|sort>%@name[%1].ind
else^echo Error: Can't find SORT^goto end
endiff
screen %_row 0
endiff
endiff
REM Select topic and show associated lines
:choice
set a=%@select[%@name[%1].ind,0,0,%_rows,%_columns, %@name[%1] Index ]
REM ascii(*) == 42, needed for *** Exit ***
if %@ascii[%a]==42 .or. "%a"=="" goto end
screen %_row 0 Searching for %@word[0,%a] ...
unset/q index
REM Problem: in output first TAB changed from column 8 to column 6. 4DOS 4.01 D
for %z in (@%1) (
iff %@ascii[%z]==58 then
iff "%z"=="%a" then^set index=1
else^if "%index"=="1" set index=2
endiff
endiff
iff "%index"=="1" then^screen %_row 0 %zn
elseiff "%index"=="2" then^goto out
endiff
)
:out
echo.^pause^screen %@eval[%_row-1] 0 ^goto choice
:info
echo Usage: %@lower[%@name[%0]] [-options] textfile.txt
text
-a create index in alphabetical order
-d delete index after use
-f force creating new index
-? this info
Let's you read special formatted text files via on-screen index.
endtext
:end
REM Delete index file, if that was requested...
if "%[%@ascii[d]]"=="1" del/q %@name[%1].ind>&nul
break off^quit