/usr/lib/surfraw/stockquote is in surfraw 2.2.9-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #!/bin/sh
# $Id$
# elvis: stockquote -- Get a single stock quote (multiple providers)
. surfraw || exit 1
w3_config_hook () {
def SURFRAW_stockquote_provider yahoo
}
w3_usage_hook () {
cat <<EOF
Usage: $w3_argv0 [options] STOCK
Description:
Surfraw fetch a single stock quote
Local options:
-provider= Quote provider to use
yahoo quote.yahoo.com
nasdaq nasdaq.com (InfoQuote)
quote quote.com
Default: $SURFRAW_stockquote_provider
Environment: SURFRAW_stockquote_provider
Examples:
$w3_argv0 Provider's standard quote page
$w3_argv0 -provider=nasdaq Use NASDAQ for quote
$w3_argv0 BLDP Obtain quote for 'Ballard Power'
EOF
w3_global_usage
}
w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
-provider=*) setopt SURFRAW_stockquote_provider $optarg ;;
*) return 1 ;;
esac
return 0
}
w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments
if test "$SURFRAW_stockquote_provider" = "yahoo"; then
if test -z "$w3_args"; then
w3_browse_url "http://quote.yahoo.com/"
else
escaped_args=`w3_url_of_arg $w3_args`
w3_browse_url "http://quote.yahoo.com/q?s=${escaped_args}"
fi
elif test "$SURFRAW_stockquote_provider" = "nasdaq"; then
if test -z "$w3_args"; then
w3_browse_url "http://www.nasdaq.com/"
else
escaped_args=`w3_url_of_arg $w3_args`
w3_browse_url "http://quotes.nasdaq.com/Quote.dll?mode=Stock&symbol=${escaped_args}&symbol=&symbol=&symbol=&symbol=&symbol=&symbol=&symbol=&symbol=&symbol=&multi.x=44&multi.y=12"
fi
elif test "$SURFRAW_stockquote_provider" = "quote"; then
if test -z "$w3_args"; then
w3_browse_url "http://www.quote.com/"
else
escaped_args=`w3_url_of_arg $w3_args`
w3_browse_url "http://www.quote.com/quotecom/stocks/quotes.asp?symbols=${escaped_args}"
fi
else
err "-provider ${SURFRAW_stockquote_provider} unsupported"
fi
|