home *** CD-ROM | disk | FTP | other *** search
Wrap
/* AminetFind script for AWeb (1.0) * $VER: AWebAminet.rexx 1.0 (30.3.96) by Sami Itkonen * * Usage: * from CLI: run >NIL: rx awebaminet.rexx * from AWeb: Select 'Start ARexx Macro' from the menu (Amiga-!) * * Read the documentation for more information. */ /* START OF CONFIGURATION VARIABLES */ def_site = 'ftp.germany.aminet.org' /* Your default Aminet site */ def_findsite = 'haegar2.uni-paderborn.de' /* Your default findserver */ def_maxhits = 20 /* Your default number of maximum hits */ use_http = "ON" /* Use http:// instead of ftp:// with certain sites */ /* END OF CONFIGURATION VARIABLES */ options results host = address() if host = "REXX" then host = "AWEB.1" else if upper(left(host,4)) ~= "AWEB" then exit address value host call Initialize parse arg args call ParseCmds action = upper(action) select when action = "FIND" then call FindWord when action = "CREATE" then call CreateForm when action = "ABOUT" then call About otherwise call CreateForm end exit FindWord: if keyword ~= "" then do 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 open(2,'tcp:'||findsite||'/1848',w) then do address command 'delete t:awebfind#?.html >NIL:' fname='t:awebfind'time(S)'.html' call open(1,fname,w) call writeln(1,'<html><head><title>AminetFind results</title></head><body>') call writeln(1,'<H1>AminetFind Results - using site 'aminetsite'</H1>') if upper(use_http) = "ON" & aminetsite = "ftp.wustl.edu" then preurl = "http://" findstr=keyword if upper(exact)="ON" then findstr='"'||findstr||'"' if upper(case)="ON" then findstr='ADTFind 'findstr else findstr = 'ADTfind 'findstr /* call writeln(1, args findstr host'<BR>')*/ call writeln(1, '<H3> Results of the search <I>"'keyword'"</I>') if exact = "ON" then call writeln(1,' (Exact)') if case = "ON" then call writeln(1,' (Case Sensitive)') call writeln(1,'</H3>') call writeln(2,'max 'maxhits) call writeln(2,'width 'width) call writeln(2,findstr) call writeln(2,'quit') do until eof(2) text=readln(2) select when left(text,9)='#error=no' then call writeln( 1, '<B>No matches found.</B><BR>') when left(text,9)='#error=ma' then call writeln( 1, '<B>Additional Matches Omitted.</B><P>') when left(text,1)='#' then foo = 1 when text = '' then foo = 1 when text = 'Unknown command (? for help).' then foo = 1 otherwise call WriteLine end end if found then call writeln(1,'</UL></PRE>') call writeln(1,'<HR><FORM ACTION="x-aweb:rexx/awebaminet.rexx">') call writeln(1,'<INPUT TYPE="HIDDEN" NAME="action" VALUE="FIND">') call writeln(1,'<B>New search:</B> <INPUT SIZE=15 MAXLENGTH=15 NAME="keyword" VALUE="">') call writeln(1,'<INPUT TYPE="HIDDEN" NAME="aminetsite" VALUE="'aminetsite'">') call writeln(1,'<INPUT TYPE="HIDDEN" NAME="findsite" VALUE="'findsite'">') call writeln(1,'<INPUT TYPE="SUBMIT" VALUE="Find"> <INPUT TYPE="RESET" VALUE="Reset"></FORM>') call writeln(1,'<EM><A href="x-aweb:rexx/awebaminet.rexx?action=create">Full Form</A></EM>') call writeln(1,'<HR>Created by 'version'</body></html>') call close(1) 'OPEN file://localhost/'fname end else FindError('Error opening TCP:') end else FindError('You need AmiTCP installed in the proper directories, or mount TCP:') end return Writeline: parse var text file.age '@' file.dir '@' file.name '@' file.size '@' a '@' b '@' file.ldesc '@' file.desc file.age = (date(i) + 2920 - file.age % 86400) % 7 file.size = trunc(file.size/1024,0) if length(file.size) > 3 then file.size = trunc(file.size/1024,1)||'M' else file.size = file.size||'K' dot = lastpos(".", file.name) if ~found then do found = 1 call writeln( 1, "<P><PRE><UL><B>FILE DIR SIZE AGE DESCRIPTION</B>" ) end if (dot > 0) then file.readme = left(file.name, dot) || 'readme' else file.readme = file.name'.readme' /* file.desc = translate(file.desc,'''','"')*/ file.desc = replace(file.desc,'<','<') file.desc = replace(file.desc,'>','>') if file.name ~= "" then do lin = '<LI><a href="'preurl||aminetsite'/pub/aminet/'file.dir'/'file.name'">'file.name'</A>' lin = lin copies(' ', 19 - length(file.name)) file.dir lin = lin copies(' ', 10 - length(file.dir)) lin = lin copies(' ', 4 - length(file.size)) file.size lin = lin copies(' ', 3 - length(file.age)) file.age lin = lin ' <a href="ftp://'aminetsite'/pub/aminet/'file.dir'/'file.readme'">'file.desc'</A>' call writeln( 1, lin) end return FindError: parse arg text address command 'delete t:awebfind#?.html >NIL:' fname='t:awebfind'time(S)'.html' call open(1,fname,w) call writeln(1,'<html><head><title>AminetFind Error</title></head><body>') call writeln(1,'<H1>AminetFind Error</H1>') call writeln(1,'<EM>'text'</EM>') call writeln(1,'<HR>Created by 'version'</body></html>') call close(1) 'OPEN file://localhost/'fname return ParseCmds: parse var args part1 "action=" '"' action '"' part2 rest = part1 part2 parse var rest part1 "keyword=" '"' keyword '"' part2 rest = part1 part2 parse var rest part1 "exact=" '"' exact '"' part2 rest = part1 part2 parse var rest part1 "case=" '"' case '"' part2 rest = part1 part2 parse var rest part1 "aminetsite=" '"' aminetsite '"' part2 rest = part1 part2 parse var rest part1 "findsite=" '"' findsite '"' part2 rest = part1 part2 parse var rest part1 "maxhits=" '"' maxhits '"' part2 rest = part1 part2 if exact = "" then exact = "OFF" if case = "" then case = "OFF" if aminetsite = "" then do if def_site ~= "" then aminetsite = def_site else aminetsite = "ftp.wustl.edu" end if findsite = "" then do if def_findsite ~= "" then findsite = def_findsite else findsite = "ftp.wustl.edu" end if maxhits = "" then do if def_maxhits ~= "" then maxhits = def_maxhits else maxhits = 20 end if rest ~= '' & right(keyword,1) = '*' then do rest = strip(rest) rest = replace(rest,'*"','"') rest = compress(rest,'"') keyword=left(keyword,length(keyword)-1) keyword = keyword||rest end return Initialize: if ~show(l, 'rexxsupport.library') then if ~addlib('rexxsupport.library', 0, -30, 0) then exit 50 /* if ~show(l, 'rexxdossupport.library') then if ~addlib('rexxdossupport.library', 0, -30, 0) then exit 50*/ keyword = "" found = 0 preurl = "ftp://" width=100 version = '<EM><A HREF="x-aweb:rexx/awebaminet.rexx?action=about">AWebAminet.rexx 1.0</A></EM> by <A HREF="mailto:Sami.Itkonen@hut.fi"><CITE>Sami Itkonen</CITE></A>' sversion = '<EM>AWebAminet.rexx 1.0</EM> by <CITE>Sami Itkonen</CITE>' return CreateForm: address command 'delete t:awebfind#?.html >NIL:' form='t:awebfind'time(S)'.html' call open(5,form,w) call writeln(5,'<html><head><title>AminetFind Form</title></head><body><h1>AminetFind Form for AWeb</H1>') call writeln(5,'<FORM ACTION="x-aweb:rexx/awebaminet.rexx"><B>') call writeln(5,'<INPUT TYPE="HIDDEN" NAME="action" VALUE="FIND">') call writeln(5,'Search for: <INPUT SIZE=15 MAXLENGTH=15 NAME="keyword" VALUE="">') call writeln(5,'Exact Match ? <INPUT TYPE="CHECKBOX" NAME="exact" VALUE="ON">') call writeln(5,'Case Sensitive ? <INPUT TYPE="CHECKBOX" NAME="case" VALUE="ON">') call writeln(5,'Maximum Number of Hits: <SELECT NAME="maxhits">') do i = 1 to 5 if maxhits % 20 = i then call writeln(5,'<OPTION SELECTED>'20*i) else call writeln(5,'<OPTION>'20*i) end call writeln(5,'</SELECT><P>Aminet site: <SELECT NAME="aminetsite">') datal = AminetSites() do i = 0 until data.i = 'ENDAMINET */' parse value sourceline(i+datal) with data.i if data.i ~= 'ENDAMINET */' & data.i ~= "" then do if data.i = def_site then call writeln(5,'<OPTION SELECTED>'data.i) else call writeln(5,'<OPTION>'data.i) end end call writeln(5,'</SELECT><P>Findserver: </B><SELECT NAME="findsite">') fsite.1 = 'ftp.wustl.edu' fsite.2 = 'haegar2.uni-paderborn.de' fsite.3 = 'amiga.icu.net.ch' do i = 1 to 3 if fsite.i = def_findsite then call writeln(5,'<OPTION SELECTED>'fsite.i) else call writeln(5,'<OPTION>'fsite.i) end call writeln(5,'</SELECT><HR><INPUT TYPE="SUBMIT" VALUE="Find"> <INPUT TYPE="RESET" VALUE="Reset"></FORM>') call writeln(5,'<HR>Created by 'version'</body></html>') call close(5) 'OPEN file://localhost/'form return About: address command 'delete t:awebfind#?.html >NIL:' about='t:awebfind'time(S)'.html' call open(5,about,w) call writeln(5,'<html><head><title>About AWebAminet</title></head><body>') call writeln(5,'<H1>AWebAminet.rexx - AminetFind script for AWeb</H1>') call writeln(5,'<H3>Contacting the Author:</H3>') call writeln(5,'<DL><DT><EM>Email</EM><DD><a href="mailto:Sami.Itkonen@hut.fi">Sami.Itkonen@hut.fi</a>') call writeln(5,'<DT><EM>WWW</EM><DD><a href="http://www.hut.fi/~samzait/">http://www.hut.fi/~samzait/</A></DL>') call writeln(5,'<H3>What''s there more about AWeb ?</H3>') call writeln(5,'<UL><LI>Read the <a href="file://localhost/awebaminet.doc">documentation</a> for this script') call writeln(5,'<LI>Search Aminet for <a href="x-aweb:rexx/awebaminet.rexx?action=find&keyword=aweb comm"><CITE>aweb comm</CITE></A>') call writeln(5,'<LI><a href="http://www.xs4all.nl/~yrozijn/aweb/">AWeb Home Page</A></UL>') call writeln(5,'<HR>Created by 'sversion'</body></html>') call close(5) 'OPEN file://localhost/'about return REPLACE: procedure parse arg a,b,c d=index(a,b) do while d~=0 a=insert(c,delstr(a,d,length(b)),d-1) d=index(a,b) end return a SendASite: return SIGL + 3 AminetSites: signal SendASite /* AMINET ftp.wustl.edu ftp.aminet.org ftp.amigalib.com ftp.germany.aminet.org ftp.luth.se ftp.doc.ic.ac.uk ENDAMINET */