#!/bin/sh
# $Id: ixquick,v 1.1 2006-03-15 23:05:12 ianb-guest Exp $
# elvis: ixquick		-- Search the web using ixquick (www.ixquick.com)
. surfraw || exit 1

w3_config_hook () {
def   SURFRAW_ixquick_search 'do/metasearch.pl'
def   SURFRAW_ixquick_lang 'english'
}

w3_usage_hook () {
    cat <<EOF
Usage: $w3_argv0 [options] [search words]...
Description:
  Surfraw search the web using Ixquick metasearch (www.ixquick.com)
Local options:
  -search=                      Specialized search on topic
          web		|       web
          pics		|       images
                                Environment: SURFRAW_ixquick_search

  -lang=                      	Language interface of ixquick
	english
	dansk
	deutsch
	espanol
	francais
	italiano
	nederlands
	norsk
	polski
	portugues
	suomi
	svenska
	turkce
	jiantizhongwen
	nihongo
	fantizhengwen
	hangul
                                Environment: SURFRAW_ixquick_lang
EOF
    w3_global_usage
}

w3_parse_option_hook () {
    opt="$1"
    optarg="$2"
    case "$opt" in
    -search=*)  setopt   SURFRAW_ixquick_search	$optarg ;;
    -lang=*)  setopt   SURFRAW_ixquick_lang	$optarg ;;
	*) return 1 ;;
    esac
    return 0
}

w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments
if test -z "$w3_args"; then
    w3_browse_url "http://www.ixquick.com/"
else
    escaped_args=`w3_url_of_arg $w3_args`
    w3_browse_url "http://www.ixquick.com/do/metasearch.pl?cat=${SURFRAW_ixquick_search}&cmd=process_search&language=${SURFRAW_ixquick_lang}&query=${escaped_args}"
fi


