home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 46
/
Amiga_Dream_46.iso
/
Amiga
/
Internet
/
Irc
/
ChatBox1_164.lha
/
Rexx
/
aminetfind.cb
< prev
next >
Wrap
Text File
|
1997-10-24
|
5KB
|
146 lines
/*) FASTAminetFind v2.2 by Josef Faulkner (panther@gate.net) IRC: Josef
\\\ Written for Grapevine 2.0 beta
///
\\\ Modified for ChatBox by Sami Itkonen <Sami.Itkonen@hut.fi>
///
\\\ Usage:
/// /alias find rx aminetfind.gvrexx
\\\ /find [EXACT] <"substring"|"sub strings"> [output] [-w<width>] [-m<items>]
///
\\\ Output is the command that will be launched with the results as the argument
///
\\\ Examples:
/// /find shapeshift echo
\\\ ½Echo╗á| ssfaq09.lha docs/help 48K 3 ShapeShifter FAQ 0.9 (preliminary)
/// ½Echo╗ | MacRomTest.lha misc/emu 1K 9 Shows version & verifies ShapeShifte
\\\ ...
/// Other examples:
\\\ /find shapeshift msg josef - sends output in a message to josef
/// /find shapeshift say - sends output to the channel
\\\ /find shapeshift me - if your nick is Aminet, this might be good :)
/// /find "irc client" - Searches for anything with "irc" AND "client"
\\\ /find "irc client" say - and sends it to the channel
/// /find exact "irc client" - Searches for anything with "irc client" exactly
\\\ /find exact "irc client" say - and sends it to the channel
/// /find grapevine say -m1 - Shows only one line of output
\\\ /find grapevine say -m5 - Shows 5 lines of output
/// /find grapevine say -w120 - Truncates output to 120 characters
\\\ /find grapevine say -w60 -m10 - Shows up to 10 lines truncating to 60 width
/// /find "comm/net irc grape" - Will search for comm/net (the directory)
\\\ /find exact "
///
\\\ Set maxsend to the maximum number of lines to send (does not affect echo)
///
\\\ New Stuff:
/// 1.1:
\\\ o Now searches for multiple keywords...
/// 1.2:
\\\ o Now searches for two or more words exactly. Use " quotes around the
/// search string to do this.
\\\ 2.0:
/// o Now you can set the maximum number of items (-m<num>)
\\\ o Now you can set the maximum length of hte line (-w<num>)
/// 2.1:
\\\ o bugfixes
/// 2.2:
\\\ o Now reports errors more exactly (none found, maximum matches)
/// Notes:
\\\ o If you search for more than one keyword you MUST put it in quotes.
/// o Quotes must be " quotes, not ' quotes.
\\\ o - options MUST be the last options on the line.
(*/
addr=address()
address value addr
if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then do
CMD '/echo You need rexxsupport.library version 30 or greater in libs:'
exit 10
end
maxchansend=5
maxechosend=20
width=80
bold=d2c(2)
parse arg cmds
do while left(word(cmds,words(cmds)),1)='-'
lw=upper(word(cmds,words(cmds)))
lc=left(lw,2)
num=right(lw,length(lw)-2)
if lc='-M' then do
maxchansend=num
maxechosend=num
end
if lc='-W' then do
width=num
end
cmds=reverse(cmds)
parse var cmds .' 'cmds
cmds=reverse(cmds)
end
if upper(word(cmds,1))='EXACT' then do
exact=1
parse var cmds .' 'cmds
end
else exact=0
if index(cmds,'"')>0 then do
parse var cmds '"'name'"' cmd
end
else do
parse var cmds name' 'comd
end
if exact then name='"'name'"'
if ~showlist(H,'TCP') then address command 'mount TCP: from amitcp:devs/inet-mountlist'
if ~showlist(H,'TCP') then address command 'mount TCP:'
if showlist(H,'TCP') then do
if comd='' then comd='echo'
name=strip(name)
otext='Finding: '
if exact then otext=otext||'(exact) '
otext=otext||bold||name||bold
comd=strip(comd)
if comd~='' then otext=otext||', output command 'bold||comd||bold
otext=otext||', width 'bold||width||bold
if upper(comd)~='ECHO' then do
length=maxchansend
otext=otext||', maxlength 'bold||maxchansend||bold
end
else do
length=maxechosend
otext=otext||', maxlength 'bold||maxechosend||bold
end
otext=otext||'.'
'echo 'otext
call open(2,'t:a',w)
if open(1,'tcp:ftp.wustl.edu/1848',w) then do
call writeln(1,'max 'length)
call writeln(1,'width 'width)
call writeln(1,'find 'name)
call writeln(1,'max')
cnt=0
do until eof(1)
text=readln(1)
call writeln(2,text)
if text='Missing argument.' then leave
else do
if address()='REXX' then CMD text
else do
select
when left(text,6)='*** No' then CMD '/echo No Matches Found.'
when left(text,6)='*** Ad' then CMD '/echo Additional Matches Found (use higher -m value for more).'
when comd='say' then CMD '/msg #amiga '||text
otherwise CMD '/'||comd||' '||text
end
end
end
cnt=cnt+1
if (cnt>=maxsend)&(upper(comd)~='ECHO') then leave
end
call writeln(1,'quit')
end
else CMD '/echo Error opening TCP:'
end
else CMD '/echo You need AmiTCP installed in the proper directories, or mount TCP:'