home *** CD-ROM | disk | FTP | other *** search
- #include <proto/exec.h>
- #include <proto/dos.h>
-
- #include <string.h>
-
- #define BUILDPLUGIN
- #include "v_plugin.h"
-
- #include "rev.h"
-
- // Move lib down the liblist (we're nice, aren't we?)
- long __asm __saveds __UserLibInit( register __a6 struct Library *libbase )
- {
- libbase->lib_Node.ln_Pri = -128;
- return( 0 );
- }
-
- struct TagItem tags[]á= {
-
- VPLUG_Query_Version, VERSION,
- VPLUG_Query_Revision, REVISION,
- VPLUG_Query_Infostring, (ULONG)"Voyager simple SEARCH: plugin",
- VPLUG_Query_Copyright, (ULONG)"(C) 1997 Oliver Wagner <owagner@vapor.com>, All Rights Reserved",
-
- VPLUG_Query_RegisterURLMethod, (ULONG)"SEARCH:",
-
- TAG_DONE
- };
-
- struct TagItem * __asm __saveds VPLUG_Query( void )
- {
- return tags;
- }
-
- // sprintf() replacement
- UWORD fmtfunc[] = {á0x16c0, 0x4e75 };
- void __stdargs sprintf( char *to, char *fmt, ... )
- {
- RawDoFmt( fmt, &fmt + 1, (APTR)fmtfunc, to );
- }
-
- #define QUERYFORM \
- "<BODY><TITLE>Voyager WebSearch</TITLE><BODY>"\
- "<center>"\
- "<hr>"\
- "<h1>Voyager WebSearch</h1>"\
- "<form action=search:>"\
- "<b>Enter search keywords:</b><br>"\
- "<input type=text name=keywords size=40><input type=submit Value=Start>"\
- "</FORM><hr>"\
- "<font size=-2>Voyager WebSearch Plugin " VERTAG "</font>"
-
- #define RESPONSE \
- "<title>Voyager WebSearch RESULTS</title>"\
- "<frameset rows=*,*>"\
- "<frameset cols=*,*>"\
- "<frame src=http://altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=.&q=%s>"\
- "<frame src=http://www.webcrawler.com/cgi-bin/WebQuery?mode=compact&maxHits=50&searchText=%s>"\
- "</frameset>"\
- "<frameset cols=*,*>"\
- "<frame src=http://www.lycos.com/cgi-bin/pursuit?cat=lycos&query=%s&matchmode=and>"\
- "<frame src=http://search.yahoo.com/bin/search?p=%s>"\
- "</frameset>"\
- "</frameset>"
-
- APTR __asm __saveds VPLUG_ProcessURLMethod( register __a0 STRPTR url )
- {
- char *res, *p;
-
- res = AllocVec( 1024, 0 );
- strcpy( res, "<TITLE>Search Error</TITLE><BODY><H2>Internal error" );
-
- // ok, check the stuff
- p = strchr( url, ':' );
- if( p++ )
- {
- p = stpblk( p );
- if( !*p )
- {
- strcpy( res, QUERYFORM );
- }
- else
- {
- if( !strncmp( p, "?keywords=", 10 ) )
- p += 10;
-
- // ready to form response
- sprintf( res, RESPONSE, p, p, p, p );
- }
- }
-
- return( res );
- }
-
- STRPTR __asm __saveds VPLUG_GetURLData( register __a0 APTR urlhandle )
- {
- return( urlhandle );
- }
-
- STRPTR __asm __saveds VPLUG_GetURLMIMEType( register __a0 APTR urlhandle )
- {
- return( "text/html" );
- }
-
- void __asm __saveds VPLUG_FreeURLData( register __a0 APTR urlhandle )
- {
- FreeVec( urlhandle );
- }
-