changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / rc/bin/weather

changeset 7243: 34f64dcbbc25
parent: 1839d28abe5b
author: cinap_lenrek@felloff.net
date: Fri, 17 May 2019 18:14:10 +0200
permissions: -rwxr-xr-x
description: 7l: don't hardcode 4k pagesize, use INITRND
1 #!/bin/rc
2 
3 rfork e
4 
5 DEFAULT=ewr
6 
7 fn usage{
8  echo 'usage: weather 3-letter-city-code' >[1=2]
9  echo 'for a list of cities in new york, say' >[1=2]
10  echo ' weather ny' >[1=2]
11  exit usage
12 }
13 
14 switch($#*){
15 case 0
16  arg=$DEFAULT
17  if(~ $#weather 1)
18  arg=$weather
19 case 1
20  arg=$1
21 case *
22  usage
23 }
24 
25 switch($arg){
26 case [a-zA-Z][a-zA-Z][a-zA-Z]
27  script=('' '' 'C' '4' '1' '1' $arg '' '' '' '' 'X')
28 case [a-zA-Z][a-zA-Z]
29  script=('' '' 'C' '4' '1' '3' $arg '' '' '' '' 'X')
30 case *
31  usage
32 }
33 
34 {
35  for(i in $script)
36  echo $i
37 } |
38 con -nrl tcp!rainmaker.wunderground.com!telnet |
39 sed -n '/Enter .-letter .* code:/,/CITY FORECAST MENU/p' |
40 sed 's/Enter .-letter .* code: //' |
41 sed 's/ Press Return to continue, M to return to menu, X to exit: //' |
42 grep -v 'CITY FORECAST MENU' |
43 tr -d '
44 ' |
45 sed 's/ *$//' |
46 uniq |
47 sed -n '/^VTEC/q; p'