[Surfraw-commits] [SCM] surfraw - a fast unix command line interface to WWW branch, master, updated. surfraw_2-2-5_1-43-gc28ae9b
Ian Beckwith
ianb at erislabs.net
Tue Nov 10 19:51:49 UTC 2009
The following commit has been merged in the master branch:
commit c28ae9becdf2d5cf505b9df45a3da1210962fce8
Author: Ian Beckwith <ianb at erislabs.net>
Date: Tue Nov 10 19:51:10 2009 +0000
New elvi: acronym, gcache (google cache). Thanks to fittabile at lifegate.it
diff --git a/ChangeLog b/ChangeLog
index 8575832..7f9401a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-10 Ian Beckwith <ianb at erislabs.net>
+
+ * New elvi: acronym, gcache (google cache).
+ Thanks to fittabile at lifegate.it
+
2009-11-08 Ian Beckwith <ianb at erislabs.net>
* New elvi: youtube. Thanks to Sumant Oemrawsingh.
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index ef1f3ce..da110db 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -3,6 +3,7 @@ elvidir=$(ELVIDIR)
dist_elvi_SCRIPTS = \
W \
+ acronym \
alioth \
altavista \
amazon \
@@ -44,14 +45,15 @@ dist_elvi_SCRIPTS = \
freedb \
freshmeat \
fsfdir \
+ gcache \
genbugs \
genpkg \
genportage \
gutenberg \
- ixquick \
google \
happypenguin \
imdb \
+ ixquick \
javasun \
scpan \
slinuxdoc \
diff --git a/elvi/Makefile.in b/elvi/Makefile.in
index 4afed4f..1f58a10 100644
--- a/elvi/Makefile.in
+++ b/elvi/Makefile.in
@@ -43,19 +43,19 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am__dist_elvi_SCRIPTS_DIST = W alioth altavista amazon archpkg arxiv \
- ask aur austlii bbcnews cddb cia cite cliki cnn codesearch \
- comlaw ctan currency cve debbugs debcontents deblists deblogs \
- debpackages debpts debsec debvcsbrowse debwiki deja discogs \
- dmoz ebay etym excite fast foldoc filesearching freebsd freedb \
- freshmeat fsfdir genbugs genpkg genportage gutenberg ixquick \
- google happypenguin imdb javasun scpan slinuxdoc l1sp lastfm \
- leodict lsm mathworld mininova musicbrainz netbsd ntrs openbsd \
- piratebay pgpkeys port pubmed rae rfc rhyme scholar scicom \
- slashdot sourceforge springer stockquote sunonesearch \
- thesaurus translate urban w3css w3html w3link w3rdf wayback \
- webster wetandwild wikipedia woffle yahoo youtube yubnub \
- opensearch
+am__dist_elvi_SCRIPTS_DIST = W acronym alioth altavista amazon archpkg \
+ arxiv ask aur austlii bbcnews cddb cia cite cliki cnn \
+ codesearch comlaw ctan currency cve debbugs debcontents \
+ deblists deblogs debpackages debpts debsec debvcsbrowse \
+ debwiki deja discogs dmoz ebay etym excite fast foldoc \
+ filesearching freebsd freedb freshmeat fsfdir gcache genbugs \
+ genpkg genportage gutenberg google happypenguin imdb ixquick \
+ javasun scpan slinuxdoc l1sp lastfm leodict lsm mathworld \
+ mininova musicbrainz netbsd ntrs openbsd piratebay pgpkeys \
+ port pubmed rae rfc rhyme scholar scicom slashdot sourceforge \
+ springer stockquote sunonesearch thesaurus translate urban \
+ w3css w3html w3link w3rdf wayback webster wetandwild wikipedia \
+ woffle yahoo youtube yubnub opensearch
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -161,16 +161,16 @@ top_srcdir = @top_srcdir@
# $Id$
elvidir = $(ELVIDIR)
-dist_elvi_SCRIPTS = W alioth altavista amazon archpkg arxiv ask aur \
- austlii bbcnews cddb cia cite cliki cnn codesearch comlaw ctan \
- currency cve debbugs debcontents deblists deblogs debpackages \
- debpts debsec debvcsbrowse debwiki deja discogs dmoz ebay etym \
- excite fast foldoc filesearching freebsd freedb freshmeat \
- fsfdir genbugs genpkg genportage gutenberg ixquick google \
- happypenguin imdb javasun scpan slinuxdoc l1sp lastfm leodict \
- lsm mathworld mininova musicbrainz netbsd ntrs openbsd \
- piratebay pgpkeys port pubmed rae rfc rhyme scholar scicom \
- slashdot sourceforge springer stockquote sunonesearch \
+dist_elvi_SCRIPTS = W acronym alioth altavista amazon archpkg arxiv \
+ ask aur austlii bbcnews cddb cia cite cliki cnn codesearch \
+ comlaw ctan currency cve debbugs debcontents deblists deblogs \
+ debpackages debpts debsec debvcsbrowse debwiki deja discogs \
+ dmoz ebay etym excite fast foldoc filesearching freebsd freedb \
+ freshmeat fsfdir gcache genbugs genpkg genportage gutenberg \
+ google happypenguin imdb ixquick javasun scpan slinuxdoc l1sp \
+ lastfm leodict lsm mathworld mininova musicbrainz netbsd ntrs \
+ openbsd piratebay pgpkeys port pubmed rae rfc rhyme scholar \
+ scicom slashdot sourceforge springer stockquote sunonesearch \
thesaurus translate urban w3css w3html w3link w3rdf wayback \
webster wetandwild wikipedia woffle yahoo youtube yubnub \
$(am__append_1)
diff --git a/elvi/acronym b/elvi/acronym
new file mode 100755
index 0000000..56199ce
--- /dev/null
+++ b/elvi/acronym
@@ -0,0 +1,168 @@
+#!/bin/sh
+# $Id$
+# elvis: acronym -- Look for acronyms definitions (www.acronymfinder.com)
+. surfraw || exit 1
+
+w3_config_hook () {
+ defyn SURFRAW_acronym_ict 0
+ defyn SURFRAW_acronym_sci 0
+ defyn SURFRAW_acronym_gov 0
+ defyn SURFRAW_acronym_org 0
+ defyn SURFRAW_acronym_biz 0
+ defyn SURFRAW_acronym_pop 0
+ defyn SURFRAW_acronym_exa 1
+ defyn SURFRAW_acronym_wim 0
+ defyn SURFRAW_acronym_zip 0
+ defyn SURFRAW_acronym_ran 0
+ defyn SURFRAW_acronym_gen 0
+ defyn SURFRAW_acronym_alpha 0
+ defyn SURFRAW_acronym_attic 0
+ def SURFRAW_acronym_path
+ def SURFRAW_acronym_par
+
+}
+
+w3_usage_hook () {
+ cat <<EOF
+Usage: $w3_argv0 [option] [keyword]
+Description:
+ Surfraw searches for possible definitions of acronyms using acronymfinder.com
+Local option:
+ -i -ict List all acronyms matching in Information Technology category
+ -s -sci List all acronyms matching in Science & Medicine category
+ -g -gov List all acronyms matching in Government & Military category
+ -o -org List all acronyms matching in Organizations & Schools category
+ -b -biz List all acronyms matching in Business & Finance category
+ -c -common List all acronyms matching in Slang & Pop Culture category
+ -e -exact List all acronyms matching with exact match (Default when keyword specified)
+ -w -wim List all acronyms matching with Word(s) in meaning match
+ -z -zip List all acronyms matching with Location (postal code, name) match
+ -r -random List a random acronym (Default when no keyword specified)
+ -f -fake List a fake acronym generated with the Acronym Finder Random Systematic Buzz Phrase Projector (AFRSBPP)
+ -a -alphabetic List all acronyms matching sorted alphabetically instead of by rank
+ -u -unverified List all acronyms matching, included those unverified by men and potentially misleading (Acronym Attic)
+
+
+
+EOF
+ w3_global_usage
+}
+
+w3_parse_option_hook () {
+ opt="$1"
+ optarg="$2"
+ case "$opt" in
+#Information Technology category
+ -i*) setoptyn SURFRAW_acronym_ict 1
+ setoptyn SURFRAW_acronym_sci 0
+ setoptyn SURFRAW_acronym_gov 0
+ setoptyn SURFRAW_acronym_org 0
+ setoptyn SURFRAW_acronym_biz 0
+ setoptyn SURFRAW_acronym_pop 0 ;;
+#Science & Medicine category
+ -s*) setoptyn SURFRAW_acronym_sci 1
+ setoptyn SURFRAW_acronym_ict 0
+ setoptyn SURFRAW_acronym_gov 0
+ setoptyn SURFRAW_acronym_org 0
+ setoptyn SURFRAW_acronym_biz 0
+ setoptyn SURFRAW_acronym_pop 0 ;;
+#Government & Military category
+ -g*) setoptyn SURFRAW_acronym_gov 1
+ setoptyn SURFRAW_acronym_sci 0
+ setoptyn SURFRAW_acronym_ict 0
+ setoptyn SURFRAW_acronym_org 0
+ setoptyn SURFRAW_acronym_biz 0
+ setoptyn SURFRAW_acronym_pop 0 ;;
+#Organizations & Schools category
+ -o*) setoptyn SURFRAW_acronym_org 1
+ setoptyn SURFRAW_acronym_sci 0
+ setoptyn SURFRAW_acronym_gov 0
+ setoptyn SURFRAW_acronym_ict 0
+ setoptyn SURFRAW_acronym_biz 0
+ setoptyn SURFRAW_acronym_pop 0 ;;
+#Business & Finance category
+ -b*) setoptyn SURFRAW_acronym_biz 1
+ setoptyn SURFRAW_acronym_sci 0
+ setoptyn SURFRAW_acronym_gov 0
+ setoptyn SURFRAW_acronym_org 0
+ setoptyn SURFRAW_acronym_ict 0
+ setoptyn SURFRAW_acronym_pop 0 ;;
+#Slang & Pop Culture category
+ -c*) setoptyn SURFRAW_acronym_pop 1
+ setoptyn SURFRAW_acronym_sci 0
+ setoptyn SURFRAW_acronym_gov 0
+ setoptyn SURFRAW_acronym_org 0
+ setoptyn SURFRAW_acronym_biz 0
+ setoptyn SURFRAW_acronym_ict 0 ;;
+#exact match
+ -e*) setoptyn SURFRAW_acronym_exa 1
+ setoptyn SURFRAW_acronym_wim 0
+ setoptyn SURFRAW_acronym_zip 0 ;;
+#Word(s) in meaning match
+ -w*) setoptyn SURFRAW_acronym_wim 1
+ setoptyn SURFRAW_acronym_exa 0
+ setoptyn SURFRAW_acronym_zip 0 ;;
+#Location (postal code, name) match
+ -z*) setoptyn SURFRAW_acronym_zip 1
+ setoptyn SURFRAW_acronym_wim 0
+ setoptyn SURFRAW_acronym_exa 0 ;;
+#Random acronym
+ -r*) setoptyn SURFRAW_acronym_ran 1
+ setoptyn SURFRAW_acronym_gen 0 ;;
+#Fake acronym
+ -f*) setoptyn SURFRAW_acronym_gen 1
+ setoptyn SURFRAW_acronym_ran 0 ;;
+#Sort alphabetically
+ -a*) setoptyn SURFRAW_acronym_alpha 1 ;;
+#Match from Acronym Attic
+ -u*) setoptyn SURFRAW_acronym_attic 1 ;;
+
+ *) return 1 ;;
+ esac
+ return 0
+}
+
+w3_config
+w3_parse_args "$@"
+# w3_args now contains a list of arguments
+
+if test -z "$w3_args"; then
+ if [ "$SURFRAW_acronym_gen" = 1 ]; then
+ SURFRAW_acronym_path="http://www.acronymfinder.com/buzzgen.asp" # Fake Acronym
+ else SURFRAW_acronym_path="http://www.acronymfinder.com/random.aspx" # Random Acronym
+ fi
+else
+ escaped_args=`w3_url_of_arg $w3_args`
+ if [ "$SURFRAW_acronym_attic" = 1 ]; then
+ SURFRAW_acronym_path="http://www.acronymattic.com/~/search/aa.aspx?Acronym=" # Acronym Attic
+ else
+ SURFRAW_acronym_path="http://www.acronymfinder.com/~/search/af.aspx?Acronym=" # Acronym Finder
+ if [ "$SURFRAW_acronym_exa" = 1 ]; then
+ par="exact"
+ elif [ "$SURFRAW_acronym_wim" = 1 ]; then
+ par="on"
+ elif [ "$SURFRAW_acronym_zip" = 1 ]; then
+ par="zip"
+ fi
+ SURFRAW_acronym_par="&Find=find&string=$par&Page=1"
+ if [ "$SURFRAW_acronym_ict" = 1 ]; then
+ par="IT"
+ elif [ "$SURFRAW_acronym_sci" = 1 ]; then
+ par="SciMed"
+ elif [ "$SURFRAW_acronym_gov" = 1 ]; then
+ par="MilGov"
+ elif [ "$SURFRAW_acronym_org" = 1 ]; then
+ par="Org"
+ elif [ "$SURFRAW_acronym_biz" = 1 ]; then
+ par="Business"
+ elif [ "$SURFRAW_acronym_pop" = 1 ]; then
+ par="Slang"
+ fi
+ SURFRAW_acronym_par="$SURFRAW_acronym_par&Category=$par"
+ fi
+ if [ "$SURFRAW_acronym_alpha" = 1 ]; then
+ SURFRAW_acronym_par="$SURFRAW_acronym_par&s=a"
+ fi
+fi
+w3_browse_url "$SURFRAW_acronym_path${escaped_args}$SURFRAW_acronym_par"
+
diff --git a/elvi/gcache b/elvi/gcache
new file mode 100755
index 0000000..8dae92a
--- /dev/null
+++ b/elvi/gcache
@@ -0,0 +1,49 @@
+#!/bin/sh
+# $Id$
+# elvis: gcache -- Search the web using Google cache (www.google.com)
+. surfraw || exit 1
+
+w3_config_hook () {
+ defyn SURFRAW_cache_graphic 0
+}
+
+w3_usage_hook () {
+ cat <<EOF
+Usage: $w3_argv0 [option] [URL]...
+Description:
+ Surfraw shows the cached page using Google (www.google.com)
+Local option:
+ -i, -images Retrieve the stored page WITH images and media.
+ Default: textonly.
+EOF
+ w3_global_usage
+}
+
+w3_parse_option_hook () {
+ opt="$1"
+ optarg="$2"
+ case "$opt" in
+ -i*) setoptyn SURFRAW_cache_graphic 1 ;;
+ *) return 1 ;;
+ esac
+ return 0
+}
+
+w3_config
+w3_parse_args "$@"
+# w3_args now contains a list of arguments
+
+if !( test -n "$SURFRAW_lang" ); then
+ SURFRAW_lang="en";
+fi
+
+if test -z "$w3_args"; then
+ w3_browse_url "http://www.google.com/intl/$SURFRAW_lang/help/features_list.html#cached"
+else
+ escaped_args=`w3_url_of_arg $w3_args`
+ if [ "$SURFRAW_cache_graphic" = 1 ]; then
+ w3_browse_url "http://www.google.com/search?q=cache:${escaped_args}&hl=$SURFRAW_lang"
+ else
+ w3_browse_url "http://www.google.com/search?q=cache:${escaped_args}&hl=$SURFRAW_lang&strip=1"
+ fi
+fi
diff --git a/links.IN b/links.IN
index a1d4e43..fc8f3ac 100644
--- a/links.IN
+++ b/links.IN
@@ -1,4 +1,5 @@
elvi.1sr.gz @mandir@/man1/W.1.gz
+elvi.1sr.gz @mandir@/man1/acronym.1sr.gz
elvi.1sr.gz @mandir@/man1/alioth.1sr.gz
elvi.1sr.gz @mandir@/man1/altavista.1sr.gz
elvi.1sr.gz @mandir@/man1/amazon.1sr.gz
@@ -40,6 +41,7 @@ elvi.1sr.gz @mandir@/man1/freebsd.1sr.gz
elvi.1sr.gz @mandir@/man1/freedb.1sr.gz
elvi.1sr.gz @mandir@/man1/freshmeat.1sr.gz
elvi.1sr.gz @mandir@/man1/fsfdir.1sr.gz
+elvi.1sr.gz @mandir@/man1/gcache.1sr.gz
elvi.1sr.gz @mandir@/man1/genbugs.1sr.gz
elvi.1sr.gz @mandir@/man1/genpkg.1sr.gz
elvi.1sr.gz @mandir@/man1/genportage.1sr.gz
diff --git a/test/acronym.test b/test/acronym.test
new file mode 100644
index 0000000..f1f5370
--- /dev/null
+++ b/test/acronym.test
@@ -0,0 +1,10 @@
+sr acronym -e NASA
+National Aeronautics and Space Administration \(USA\)
+sr acronym -u NASA
+National Association for the Advancement
+sr acronym surfraw
+What does SURFRAW stand for\?
+sr acronym -f
+Systematic Buzz Phrase Projector \(SBPP\) number
+sr acronym -a aaa
+Academia de Automovilismo Andrade \(Guatemala\)
diff --git a/test/gcache.test b/test/gcache.test
new file mode 100644
index 0000000..d231811
--- /dev/null
+++ b/test/gcache.test
@@ -0,0 +1,4 @@
+sr gcache www.mozilla.org
+http://www.google.com/intl/[A-Za-z]+/help/features_list.html#cached
+sr gcache -i www.openoffice.org
+cache:www.openoffice.org&hl=.*&strip=1
--
surfraw - a fast unix command line interface to WWW
More information about the Surfraw-commits
mailing list