[Surfraw-commits] [surfraw] 01/01: N-O cleanup

jason ryan jasonwryan-guest at moszumanska.debian.org
Thu Jul 6 23:02:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

jasonwryan-guest pushed a commit to branch kyle/https-elvi
in repository surfraw.

commit 5a6f066f6675e4b2da57ea47258b43fc64246c33
Author: Jason Ryan <jasonwryan at gmail.com>
Date:   Fri Jul 7 11:02:09 2017 +1200

    N-O cleanup
---
 elvi/netbsd            |  22 ++----
 elvi/nlab              |   6 +-
 elvi/ntrs              |   6 +-
 elvi/openbsd           |  78 +-------------------
 elvi/openports         |  58 ---------------
 elvi/opensearch        | 191 -------------------------------------------------
 elvi/oraclesearch      |   2 +-
 test/netbsd.test       |   2 -
 test/openbsd.test      |   4 --
 test/openports.test    |   2 -
 test/opensearch.test   |   4 --
 test/oraclesearch.test |   2 +-
 12 files changed, 14 insertions(+), 363 deletions(-)

diff --git a/elvi/netbsd b/elvi/netbsd
index 0ec7f96..1c37363 100755
--- a/elvi/netbsd
+++ b/elvi/netbsd
@@ -6,7 +6,6 @@
 w3_config_hook () {
 defyn   SURFRAW_netbsd_mail	no
 defyn   SURFRAW_netbsd_pr	no
-defyn   SURFRAW_netbsd_ports    no
 }
 
 w3_usage_hook () {
@@ -21,9 +20,6 @@ Local options:
   -pr[=(yes|no)]		Query Problem Reports
   				Default: $SURFRAW_netbsd_pr
   				Environment: SURFRAW_netbsd_pr
-  -ps[=(yes|no)]		Search ports
-  				Default: $SURFRAW_netbsd_ports
-  				Environment: SURFRAW_netbsd_ports
 Examples:
   $w3_argv0 			Teleport to the NetBSD website
   $w3_argv0 mycroft		Search NetBSD website for odeur de mycroft
@@ -43,8 +39,6 @@ w3_parse_option_hook () {
 	-mail=*) setoptyn	SURFRAW_netbsd_mail		$optarg	;;
 	-pr)	setoptyn	SURFRAW_netbsd_pr		yes	;;
 	-pr=*)	setoptyn	SURFRAW_netbsd_pr		$optarg	;;
-	-ps)	setoptyn	SURFRAW_netbsd_ports		yes	;;
-	-ps=*)	setoptyn	SURFRAW_netbsd_ports		$optarg	;;
 	*) return 1 ;;
     esac
     return 0
@@ -55,32 +49,24 @@ w3_parse_args "$@"
 # w3_args now contains a list of arguments
 test -z "$w3_args" || escaped_args=`w3_url_of_arg $w3_args`
 
-if ok SURFRAW_netbsd_ports; then
-    if test -z "$escaped_args"; then
-        w3_browse_url "http://pkgsrc.se/"
-    else
-        w3_browse_url "http://pkgsrc.se/search.php?so=${escaped_args}"
-    fi
-    exit $?
-fi
 if ok SURFRAW_netbsd_pr; then
     if test -z "$escaped_args"; then
-        w3_browse_url "http://www.netbsd.org/Misc/query-pr.html"
+        w3_browse_url "https://www.netbsd.org/Misc/query-pr.html"
     else
-        w3_browse_url "http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=${escaped_args}"
+        w3_browse_url "https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=${escaped_args}"
     fi
     exit $?
 fi
 if ok SURFRAW_netbsd_mail; then
     if test -z "$escaped_args"; then
-        w3_browse_url "http://mail-index.netbsd.org/"
+        w3_browse_url "https://mail-index.netbsd.org/"
     else
         w3_custom_search -s=mail-index.netbsd.org "$w3_shquoted_args"
     fi
     exit $?
 fi
 if test -z "$escaped_args"; then
-    w3_browse_url "http://www.netbsd.org/"
+    w3_browse_url "https://www.netbsd.org/"
 else
     w3_custom_search -s=netbsd.org "$w3_shquoted_args"
 fi
diff --git a/elvi/nlab b/elvi/nlab
index 2e086fe..fcc976c 100755
--- a/elvi/nlab
+++ b/elvi/nlab
@@ -8,7 +8,7 @@ w3_usage_hook () {
     cat <<EOF
 Usage: $w3_argv0 [search terms]...
 Description:
-    Search the nLab Wiki (http://ncatlab.org)
+    Search the nLab Wiki (https://ncatlab.org)
 
     Local options:
     The nLab wiki search accepts regular expressions as search terms.
@@ -22,8 +22,8 @@ w3_parse_args "$@"
 
 # w3_args now contains a list of arguments
 if [ -z "$w3_args" ]; then
-    w3_browse_url "http://ncatlab.org/"
+    w3_browse_url "https://ncatlab.org/"
 else
     escaped_args=$(w3_url_of_arg $w3_args)
-    w3_browse_url "http://ncatlab.org/nlab/search?&query=${escaped_args}"
+    w3_browse_url "https://ncatlab.org/nlab/search?&query=${escaped_args}"
 fi
diff --git a/elvi/ntrs b/elvi/ntrs
index 186b4ca..4402c3f 100755
--- a/elvi/ntrs
+++ b/elvi/ntrs
@@ -72,15 +72,15 @@ case "$SURFRAW_ntrs_results" in
 esac
 
 if null "$w3_args"; then
-    w3_browse_url "http://ntrs.nasa.gov/search.jsp"
+    w3_browse_url "https://ntrs.nasa.gov/search.jsp"
 else
     # TODO: combine multiple searches, e.g.
     # first search the abstract for certain keywords,
     # then search the authors of those results
     # this gives urls that look like this:
-    #http://ntrs.nasa.gov/search.jsp?N=0&Ntk=Abstract|AuthorList&Ntx=mode%20matchall|mode%20matchall&Ntt=free%20wake|wachspress
+    #https://ntrs.nasa.gov/search.jsp?N=0&Ntk=Abstract|AuthorList&Ntx=mode%20matchall|mode%20matchall&Ntt=free%20wake|wachspress
     escaped_args=`w3_url_of_arg $w3_args`
-    url="http://ntrs.nasa.gov/search.jsp?N=0&Ntk=${field}&Ntx=mode%20${result}&Ntt=${escaped_args}"
+    url="https://ntrs.nasa.gov/search.jsp?N=0&Ntk=${field}&Ntx=mode%20${result}&Ntt=${escaped_args}"
     w3_browse_url "${url}"
 fi
 
diff --git a/elvi/openbsd b/elvi/openbsd
index 53ef839..cc2cdcf 100755
--- a/elvi/openbsd
+++ b/elvi/openbsd
@@ -3,99 +3,25 @@
 # elvis: openbsd		-- Search OpenBSD related information (www.openbsd.org)
 . surfraw || exit 1
 
-w3_config_hook () {
-defyn   SURFRAW_openbsd_mail            no
-defyn   SURFRAW_openbsd_pr              no
-defyn   SURFRAW_openbsd_ports           no
-defyn   SURFRAW_openbsd_mail_misc	no
-defyn   SURFRAW_openbsd_mail_tech	no
-}
-
 w3_usage_hook () {
     cat <<EOF
-Usage: $w3_argv0 [options] [search-string | PR-number]
+Usage: $w3_argv0 [search-string]
 Description:
   Surfraw search OpenBSD related information
-Local options:
-  -mail[=(yes|no)]              Search OpenBSD mailinglists
-                                Default: $SURFRAW_openbsd_mail
-                                Environment: SURFRAW_openbsd_mail
-  -ps[=(yes|no)]                Search ports.
-                                Default: $SURFRAW_openbsd_ports
-                                Environment: SURFRAW_openbsd_ports
-  -misc[=(yes|no)]		Search misc mailing list.
-				Default: $SURFRAW_openbsd_mail_misc
-  -tech[=(yes|no)]		Search tech mailing list.
-				Default: $SURFRAW_openbsd_mail_tech
 Examples:
   $w3_argv0                     Teleport to the OpenBSD website
-  $w3_argv0 mycroft             Search OpenBSD website for odeur de mycroft
-  $w3_argv0 -mail               Teleport to the mail-index Query form
-  $w3_argv0 -mail proff         Search mailing-list archives for odeur de proff
-  $w3_argv0 -ps surfraw         Search ports for surfraw
-  $w3_argv0 -misc supermicro    Search misc mailing list for supermico
-  $w3_argv0 -tech SMP           Search tech mailing list for SMP
 EOF
     w3_custom_search_usage
     w3_global_usage
 }
 
-w3_parse_option_hook () {
-    opt="$1"
-    optarg="$2"
-    case "$opt" in
-	-mail)		setoptyn	SURFRAW_openbsd_mail		yes	;;
-	-mail=*) 	setoptyn	SURFRAW_openbsd_mail		$optarg	;;
-	-ps)		setoptyn	SURFRAW_openbsd_ports		yes	;;
-	-ps=*)		setoptyn	SURFRAW_openbsd_ports		$optarg	;;
-	-misc)		setoptyn	SURFRAW_openbsd_mail_misc	yes	;;
-	-misc=*)	setoptyn	SURFRAW_openbsd_mail_misc 	$optarg	;;
-	-tech)		setoptyn	SURFRAW_openbsd_mail_tech 	yes	;;
-	-tech=*)	setoptyn	SURFRAW_openbsd_mail_tech 	$optarg	;;
-	*) return 1 ;;
-    esac
-    return 0
-}
-
 w3_config
 w3_parse_args "$@"
 # w3_args now contains a list of arguments
 test -z "$w3_args" || escaped_args=`w3_url_of_arg $w3_args`
 
-if ok SURFRAW_openbsd_ports; then
-    if test -z "$escaped_args"; then
-        w3_browse_url "http://openports.se/"
-    else
-        w3_browse_url "http://openports.se/search.php?so=${escaped_args}"
-    fi
-    exit $?
-fi
-if ok SURFRAW_openbsd_mail; then
-    if test -z "$escaped_args"; then
-        w3_browse_url "http://www.openbsd.org/mail.html"
-    else
-        w3_browse_url "http://search.gmane.org/?query=${escaped_args}&sort=relevance&DEFAULTOP=and&group=gmane.os.openbsd.*"
-    fi
-    exit $?
-fi
-if ok SURFRAW_openbsd_mail_misc; then
-    if test -z "$escaped_args"; then
-        w3_browse_url "http://marc.info/?l=openbsd-misc&r=1&w=2"
-    else
-	w3_browse_url "http://marc.info/?l=openbsd-misc&w=2&r=1&s=${escaped_args}&q=b"
-    fi
-    exit $?
-fi
-if ok SURFRAW_openbsd_mail_tech; then
-    if test -z "$escaped_args"; then
-        w3_browse_url "http://marc.info/?l=openbsd-tech&r=1&w=2"
-    else
-	w3_browse_url "http://marc.info/?l=openbsd-tech&w=2&r=1&s=${escaped_args}&q=b"
-    fi
-    exit $?
-fi
 if test -z "$escaped_args"; then
-    w3_browse_url "http://www.openbsd.org/"
+    w3_browse_url "https://www.openbsd.org/"
 else
     w3_custom_search -s=openbsd.org "$w3_shquoted_args"
 fi
diff --git a/elvi/openports b/elvi/openports
deleted file mode 100755
index 577be98..0000000
--- a/elvi/openports
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-# elvis: openports	-- search openports for OpenBSD packages
-# coder at kyleisom.net 20110105
-. surfraw || exit 1
-
-w3_config_hook () {
-    def     SURFRAW_openports_search    "http://openports.se/search.php?"
-    def     SURFRAW_openports_stype     ""
-}
-
-w3_usage_hook () {
-    cat <<EOF
-Usage: $w3_argv0 [options] [search words]...
-Description:
-    Search openports for OpenBSD packages / ports. Only one search is active
-    at a time. Feel free to n00b it up and use more than one flag. Go ahead,
-    just try.
-Local options:
-  -m,-maintainer                search by maintainer
-  -c,-comment                   search by comment
-  -b,-builddeps                 search by build dependencies
-  -r,-rundeps                   search by run dependencies
-  -s,-mastersite                search by master site
-  -d,-description               search by description
-  -l,-commitlogs                search by commit logs
-EOF
-    w3_global_usage
-}
-
-w3_parse_option_hook () {
-    opt="$1"
-    optarg="$2"
-    case "$opt" in
-    -m|-mai*)           setopt  SURFRAW_openports_stype     "maintainer"    ;;
-    -c|-comme*)         setopt  SURFRAW_openports_stype     "comment"       ;;
-    -b|-bu*)            setopt  SURFRAW_openports_stype     "dependbuild"   ;;
-    -r|-ru*)            setopt  SURFRAW_openports_stype     "dependrun"     ;;
-    -s|-mas*)           setopt  SURFRAW_openports_stype     "MASTER_SITES"  ;;
-    -d|-de*)            setopt  SURFRAW_openports_stype     "description"   ;;
-    -l|-commi*)         setopt  SURFRAW_openports_stype     "commitlog"     ;;
-    *) return 1 ;;
-    esac
-    return 0
-}
-
-w3_config
-w3_parse_args "$@"
-# w3_args now contains a list of arguments
-
-escaped_args=`w3_url_of_arg $w3_args`
-
-if test -z $SURFRAW_openports_stype ; then
-    url="${SURFRAW_openports_search}so=${escaped_args}"
-else
-    url="${SURFRAW_openports_search}stype=${SURFRAW_openports_stype}&so=${escaped_args}"
-fi
-
-w3_browse_url $url
diff --git a/elvi/opensearch b/elvi/opensearch
deleted file mode 100755
index 558c0e8..0000000
--- a/elvi/opensearch
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/bin/sh
-# elvis: opensearch	-- Search an OpenSearch-enabled website
-# ianb at erislabs.net 20060903
-
-. surfraw || exit 1
-
-w3_config_hook () {
-def   SURFRAW_opensearch_title          ""
-def   SURFRAW_opensearch_count          $SURFRAW_results
-def   SURFRAW_opensearch_startindex     ""
-def   SURFRAW_opensearch_pageindex      ""
-def   SURFRAW_opensearch_language       "$SURFRAW_lang"
-def   SURFRAW_opensearch_inputencoding  ""
-def   SURFRAW_opensearch_outputencoding ""
-defyn SURFRAW_opensearch_list           no
-defyn SURFRAW_opensearch_redirect       no
-}
-
-w3_usage_hook () {
-    cat <<EOF
-Usage: $w3_argv0 [options] [url] [search words]...
-Description:
-  Surfraw search an OpenSearch-enabled website.
-  If opensearch-discover and opensearch-genquery are installed then
-  it will handle the opensearch lookups locally, otherwise it will fall
-  back on a redirector.
-Local options:
-  -r                            Explicitly use redirector.
-  -l                            List OpenSearch searches at url.
-  -title=TITLE                  Use search with title matching TITLE.
-                                TITLE is case-insensitive.
-                                Example: -t book matches "Book Search"
-Many sites do not implement all (or any) of the following
-parameters, in which case they will be silently ignored.
-  -count=NUM                    Number of search results returned.
-                                Default: $SURFRAW_opensearch_count.
-                                Environment: SURFRAW_opensearch_count.
-                                If not set, defaults to value of SURFRAW_results
-  -index=NUM                    Offset of first result.
-  -page=NUM                     Which page of results to show.
-  -language=LANG                Language to display results in.
-                                LANG should be a 2-letter ISO country code.
-                                Examples: -l=en or -lang=de.
-				Environment: SURFRAW_opensearch_lang, SURFRAW_lang
-  -inputencoding=ENC            Specify how search terms are encoded.
-  -outputencoding=ENC           Request output encoded as ENC.
-                                Environment: SURFRAW_opensearch_search
-EOF
-    w3_global_usage
-}
-
-w3_parse_option_hook () {
-    opt="$1"
-    optarg="$2"
-    case "$opt" in
-    -t*=*)  setopt   SURFRAW_opensearch_title          "$optarg" ;;
-    -c*=*)  setopt   SURFRAW_opensearch_count          "$optarg" ;;
-    -i*=*)  setopt   SURFRAW_opensearch_startindex     "$optarg" ;;
-    -p*=*)  setopt   SURFRAW_opensearch_pageindex      "$optarg" ;;
-    -la*=*) setopt   SURFRAW_opensearch_language       "$optarg" ;;
-    -in*=*) setopt   SURFRAW_opensearch_inputencoding  "$optarg" ;;
-    -o*=*)  setopt   SURFRAW_opensearch_outputencoding "$optarg" ;;
-    -l)     setoptyn SURFRAW_opensearch_list            1        ;;
-    -r)     setoptyn SURFRAW_opensearch_redirect        yes      ;;
-	*) return 1 ;;
-    esac
-    return 0
-}
-
-w3_config
-w3_parse_args "$@"
-if test -z "$w3_args"; then
-	w3_usage_hook
-	exit 0
-fi
-
-if  ifno SURFRAW_opensearch_redirect      &&
-    [ ! -x $(which opensearch-discover) ] ||
-    [ ! -x $(which opensearch-genquery) ]
-then
-    setoptyn SURFRAW_opensearch_redirect yes
-fi
-
-# Clobbers command line, but we've already parsed it
-set $w3_args
-siteurl="$1"
-shift
-w3_args="$*"
-# w3_args now contains a list of arguments
-
-if ifyes SURFRAW_opensearch_redirect; then
-    if ifyes SURFRAW_opensearch_list; then
-	err "-l not supported with -r"
-    elif test -z "$w3_args"; then
-	w3_browse_url "$siteurl"
-    else
-	escaped_args=`w3_url_of_arg $w3_args`
-
-	if [ -n "$SURFRAW_opensearch_title" ]; then
-	    err "-t not supported with -r"
-	fi
-
-	url="http://erislabs.net/ianb/webtools/opensearch/"
-	url="${url}?site=$(w3_url_of_arg "$siteurl")"
-	url="${url}&searchTerms=${escaped_args}"
-	url="${url}&count=${SURFRAW_opensearch_count}"
-	url="${url}&startIndex=${SURFRAW_opensearch_startindex}"
-	url="${url}&pageIndex=${SURFRAW_opensearch_pageindex}"
-	url="${url}&language=${SURFRAW_opensearch_language}"
-	url="${url}&inputEncoding=${SURFRAW_opensearch_inputencoding}"
-	url="${url}&outputEncoding=${SURFRAW_opensearch_outputencoding}"
-	url="${url}&fmt=html"
-
-	w3_browse_url "$url"
-    fi
-
-else # dont use redirector
-
-    if ifyes SURFRAW_opensearch_list; then
-	opensearch-discover -q -v -a $siteurl
-	case "$?" in
-	    0) ;; # OK
-	    1) err "Cannot access $siteurl" ;;
-	    2) err "Cannot find ${matching}OpenSearch link at $siteurl"  ;;
-	    3) err "opensearch-discover: required perl module not found"  ;;
-	    *) err "Unknown error from opensearch-discover" ;;
-	esac
-
-    elif test -z "$w3_args"; then
-	w3_browse_url "$siteurl"
-    else
-	escaped_args=`w3_url_of_arg $w3_args`
-
-	discover_args="-q"
-	matching="" # for error message below
-	if [ -n "$SURFRAW_opensearch_title" ]; then
-		discover_args="-q -t $SURFRAW_opensearch_title"
-		matching="matching "
-	fi
-
-	opensearchurl=`opensearch-discover $discover_args $siteurl`
-
-	case "$?" in
-		0) ;; # OK
-		1) err "Cannot access $siteurl" ;;
-		2) err "Cannot find ${matching}OpenSearch link at $siteurl"  ;;
-		3) err "opensearch-discover: required perl module not found"  ;;
-		*) err "Unknown error from opensearch-discover" ;;
-	esac
-
-	queryargs="-q -H"
-
-	if [ -n "$SURFRAW_opensearch_count" ]; then
-		queryargs="$queryargs -c $SURFRAW_opensearch_count"
-	fi
-
-	if [ -n "$SURFRAW_opensearch_startindex" ]; then
-		queryargs="$queryargs -i $SURFRAW_opensearch_startindex"
-	fi
-
-	if [ -n "$SURFRAW_opensearch_pageindex" ]; then
-		queryargs="$queryargs -p $SURFRAW_opensearch_pageindex"
-	fi
-
-	if [ -n "$SURFRAW_opensearch_language" ]; then
-		queryargs="$queryargs -l $SURFRAW_opensearch_language"
-	fi
-
-	if [ -n "$SURFRAW_opensearch_inputencoding" ]; then
-		queryargs="$queryargs -I $SURFRAW_opensearch_inputencoding"
-	fi
-
-	if [ -n "$SURFRAW_opensearch_outputencoding" ]; then
-		queryargs="$queryargs -O $SURFRAW_opensearch_outputencoding"
-	fi
-
-	query=`opensearch-genquery $queryargs $opensearchurl $w3_args`
-
-	case "$?" in
-		0) ;; # OK
-		1) err "Cannot access OpenSearch description $opensearchurl" ;;
-		2) err "Error parsing OpenSearch Description at $opensearchurl"  ;;
-		3) err "No HTML search specified in $opensearchurl" ;;
-		4) err "opensearch-genquery: cannot find required perl module WWW::OpenSearch" ;;
-		*) err "Unknown error from opensearch-genquery" ;;
-	esac
-
-	w3_browse_url "$query"
-
-    fi
-fi
diff --git a/elvi/oraclesearch b/elvi/oraclesearch
index c316fd8..c472348 100755
--- a/elvi/oraclesearch
+++ b/elvi/oraclesearch
@@ -19,6 +19,6 @@ if test -z "$w3_args"; then
     w3_browse_url "http://search.oracle.com/search/search"
 else
     escaped_args=`w3_url_of_arg $w3_args`
-    w3_browse_url "http://search.oracle.com/search/search?q=${escaped_args}"
+    w3_browse_url "https://www.oracle.com/search/results?Ntt=${escaped_args}&Dy=1&Nty=1&Ntk=S3"
 
 fi
diff --git a/test/netbsd.test b/test/netbsd.test
index ec7e322..c31a78e 100644
--- a/test/netbsd.test
+++ b/test/netbsd.test
@@ -4,5 +4,3 @@ netbsd -pr 666
 loose source routing
 netbsd -mail netbsd
 NetBSD
-netbsd -ps surfraw
-Shell Users Revolutionary Front
diff --git a/test/openbsd.test b/test/openbsd.test
index d1080a0..e541859 100644
--- a/test/openbsd.test
+++ b/test/openbsd.test
@@ -1,6 +1,2 @@
 openbsd Raadt
 Theo de
-openbsd -mail Raadt
-Theo
-openbsd -ps surfraw
-command line interface to popular WWW search engines
diff --git a/test/openports.test b/test/openports.test
deleted file mode 100644
index 9378c1d..0000000
--- a/test/openports.test
+++ /dev/null
@@ -1,2 +0,0 @@
-openports surfraw
-www.surfraw
diff --git a/test/opensearch.test b/test/opensearch.test
deleted file mode 100644
index 959fd50..0000000
--- a/test/opensearch.test
+++ /dev/null
@@ -1,4 +0,0 @@
-opensearch en.wikipedia.org surfraw
-Julian Assange
-opensearch -r en.wikipedia.org surfraw
-Julian Assange
diff --git a/test/oraclesearch.test b/test/oraclesearch.test
index 6812192..af07b54 100644
--- a/test/oraclesearch.test
+++ b/test/oraclesearch.test
@@ -1,2 +1,2 @@
 oraclesearch mysql
-Community Edition
+Database in the cloud

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/surfraw/surfraw.git



More information about the Surfraw-commits mailing list