# Interface between web search form and Swish search engine for # International Watermark Archive. Provides context sensitive # searching, emulating a true database search. # # written by Jim Hart # Copyright (C) 1996 Bates College # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # or point your web browser to http://www.fsf.org/copyleft/gpl.html BEGIN { RS = "&" } /db=/ { split ( $0, flds, "=" ) file = flds[2] } /keywords=/ { split ( $0, flds, "=" ) keywords = flds[2] gsub(/[-_,&+!|;=`$]/," ",keywords) # clear out special chars. gsub(/\%../," ",keywords) # clear out http specials printf "Content-type: text/html\n\n" printf "" print "

" print "The Watermark Initiative

" print "

" print "

Related Records

" cmd = "/usr/local/httpd/cgi-bin/swish -f /usr/local/httpd/htdocs/Faculty/wmarchive/wminitiative/" file ".swish -w " keywords # print cmd "

" RS = "\n" while( cmd | getline ) { # clear out some unnecessary Swish output if ( $2 == "Saved" ) continue if ( $2 == "Name:" ) continue if ( $2 == "Counts:" ) continue if ( $2 == "Pointer:" ) continue if ( $2 == "Indexed" ) { continue } # if ( $2 == "Indexed" ) { $2 = "The archive submissions were last indexed for searches"; print $0 "
"; continue } if ( $2 == "Description:" ) continue if ( $2 == "SWISH" ) continue if ( $1 == "Swish" ) continue if ( $1 == "." ) continue if ( $2 == "Maintained" ) continue # if ( $1 == "search" ) { $1 = "# Search"; print $0 "
"; continue } if ( $1 == "search" ) { continue } if( $2 ~ "^http:") { # make all the search hits clickable links $2 = " \"",$0) stat = sub(/\" /,"\" ",$0) $1 = "" # remove the ranking and size fields $NF = "" } if ( $1 == "err:") { if ( $2 == "no" && $3 == "results" ) { $0 = "

There are no related records in the " file " file.

" $0 = $0 "(Use the Back function of your browser to return to the original file.)" } } print $0, "
" } print "
" }