netbsd - dotfiles - leot's dotfiles
(HTM) hg clone https://bitbucket.org/iamleot/dotfiles
(DIR) Log
(DIR) Files
(DIR) Refs
---
netbsd
---
1 #!/bin/sh
2 # $Id$
3 # elvis: netbsd -- Search NetBSD related information (www.netbsd.org)
4 . surfraw || exit 1
5
6 w3_config_hook () {
7 defyn SURFRAW_netbsd_mail no
8 defyn SURFRAW_netbsd_pr no
9 defyn SURFRAW_netbsd_ports no
10 }
11
12 w3_usage_hook () {
13 cat <<EOF
14 Usage: $w3_argv0 [options] [search-string | PR-number]
15 Description:
16 Surfraw search NetBSD related information
17 Local options:
18 -mail[=(yes|no)] Search netbsd mailinglists
19 Default: $SURFRAW_netbsd_mail
20 Environment: SURFRAW_netbsd_mail
21 -pr[=(yes|no)] Query Problem Reports
22 Default: $SURFRAW_netbsd_pr
23 Environment: SURFRAW_netbsd_pr
24 -ps[=(yes|no)] Search ports
25 Default: $SURFRAW_netbsd_ports
26 Environment: SURFRAW_netbsd_ports
27 Examples:
28 $w3_argv0 Teleport to the NetBSD website
29 $w3_argv0 mycroft Search NetBSD website for odeur de mycroft
30 $w3_argv0 -mail Teleport to the mail-index Query form
31 $w3_argv0 -mail proff Search mailing-list archives for odeur de proff
32 $w3_argv0 -pr Query Problem Report form
33 $w3_argv0 -ps surfraw Search Ports for surfraw
34 EOF
35 w3_global_usage
36 }
37
38 w3_parse_option_hook () {
39 opt="$1"
40 optarg="$2"
41 case "$opt" in
42 -mail) setoptyn SURFRAW_netbsd_mail yes ;;
43 -mail=*) setoptyn SURFRAW_netbsd_mail $optarg ;;
44 -pr) setoptyn SURFRAW_netbsd_pr yes ;;
45 -pr=*) setoptyn SURFRAW_netbsd_pr $optarg ;;
46 -ps) setoptyn SURFRAW_netbsd_ports yes ;;
47 -ps=*) setoptyn SURFRAW_netbsd_ports $optarg ;;
48 *) return 1 ;;
49 esac
50 return 0
51 }
52
53 w3_config
54 w3_parse_args "$@"
55 # w3_args now contains a list of arguments
56 test -z "$w3_args" || escaped_args=`w3_url_of_arg $w3_args`
57
58 if ok SURFRAW_netbsd_ports; then
59 if test -z "$escaped_args"; then
60 w3_browse_url "http://pkgsrc.se/"
61 else
62 w3_browse_url "http://pkgsrc.se/search.php?so=${escaped_args}"
63 fi
64 exit $?
65 fi
66 if ok SURFRAW_netbsd_pr; then
67 if test -z "$escaped_args"; then
68 w3_browse_url "http://www.netbsd.org/Misc/query-pr.html"
69 else
70 w3_browse_url "http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=${escaped_args}"
71 fi
72 exit $?
73 fi
74 if ok SURFRAW_netbsd_mail; then
75 if test -z "$escaped_args"; then
76 w3_browse_url "http://mail-index.netbsd.org/"
77 else
78 w3_custom_search -s=mail-index.netbsd.org "$w3_shquoted_args"
79 fi
80 exit $?
81 fi
82 if test -z "$escaped_args"; then
83 w3_browse_url "http://www.netbsd.org/"
84 else
85 w3_custom_search -s=netbsd.org "$w3_shquoted_args"
86 fi
87 exit $?