remove old, broken scripts: fedex, u(s)ps, weather (thanks fulton)

This commit is contained in:
Sigrid 2021-04-13 11:26:55 +02:00
parent fd4e8eef0b
commit b777d3fe7d
6 changed files with 0 additions and 210 deletions

View file

@ -1,62 +0,0 @@
#!/bin/rc
if(! ~ $#* 1) {
echo usage: fedex 123456789012 >[1=2]
exit usage
}
rfork e
fn bgrep{
pattern=`{echo $1 | sed 's;/;\\&;'}
shift
@{ echo 'X {
$
a
.
}
X ,x/(.+\n)+\n/ g/'$pattern'/p' |
sam -d $* >[2]/dev/null
}
}
fn awk2 {
awk 'NR%2==1 { a=$0; }
NR%2==0 { b=$0; printf("%-30s %s\n", a, b); }
' $*
}
fn awk3 {
awk '{line[NR] = $0}
END{
i = 4;
while(i < NR){
what=line[i++];
when=line[i];
comment="";
if(!(when ~ /..\/..\/.... ..:../)){
# out of sync
printf("%s\n", what);
continue;
}
i++;
if(!(line[i+1] ~ /..\/..\/.... ..:../) &&
(i+2 > NR || line[i+2] ~ /..\/..\/.... ..:../)){
what = what ", " line[i++];
}
printf("%s %s\n", when, what);
}
}' $*
}
# hget 'http://www.fedex.com/cgi-bin/track_it?airbill_list='$1'&kurrent_airbill='$1'&language=english&cntry_code=us&state=0' |
hget 'http://www.fedex.com/Tracking?action=track&language=english&cntry_code=us&initial=x&mps=y&tracknumbers='$1 |
htmlfmt >/tmp/fedex.$pid
sed -n '/Tracking number/,/^$/p' /tmp/fedex.$pid | awk2
echo
sed -n '/Reference number/,/^$/p' /tmp/fedex.$pid | awk2
echo
sed -n '/Date.time/,/^$/p' /tmp/fedex.$pid | sed 1,4d | fmt -l 4000 | sed 's/ [A-Z][A-Z] /&\n/g'
rm /tmp/fedex.$pid

View file

@ -1,15 +0,0 @@
#!/bin/rc
# ups - look up a UPS tracking number
rfork en
if(! ~ $#* 1) {
echo usage: ups 1ZA41W190338680961 >[1=2]
exit usage
}
hget 'http://wwwapps.ups.com/WebTracking/processInputRequest?tracknum='^$1^ \
'&TypeOfInquiryNumber=T' |
htmlfmt |
awk '/^Share/,/^Subscribe/ {print;}' |
grep -v '^(Share|Change Delivery|Request Status Updates|Never track again|Continue|I am already a UPS My Choice Member|• What|Subscribe to UPS)' |
ssam 's/\n\n\n/\n/g'

View file

@ -1,20 +0,0 @@
#!/bin/rc
rfork en
if(! ~ $#* 1) {
echo usage: usps 01601531218002685498 >[1=2]
exit usage
}
rfork e
hget -p 'qtc_tLabels1='^$1 https://tools.usps.com/go/TrackConfirmAction |
htmlfmt > /tmp/usps.$pid
sam -d /tmp/usps.$pid >[2] /dev/null <<'!'
,/Tracking Number:/-1d
/Available Actions/,$d
,p
!
rm /tmp/usps.$pid

View file

@ -1,46 +0,0 @@
#!/bin/rc
rfork e
DEFAULT=ewr
fn usage{
echo 'usage: weather 3-letter-city-code' >[1=2]
echo 'for a list of cities in new york, say' >[1=2]
echo ' weather ny' >[1=2]
exit usage
}
switch($#*){
case 0
arg=$DEFAULT
if(~ $#weather 1)
arg=$weather
case 1
arg=$1
case *
usage
}
switch($arg){
case [a-zA-Z][a-zA-Z][a-zA-Z]
script=('' '' 'C' '4' '1' '1' $arg '' '' '' '' 'X')
case [a-zA-Z][a-zA-Z]
script=('' '' 'C' '4' '1' '3' $arg '' '' '' '' 'X')
case *
usage
}
{
for(i in $script)
echo $i
} |
con -nrl tcp!rainmaker.wunderground.com!telnet |
sed -n '/Enter .-letter .* code:/,/CITY FORECAST MENU/p' |
sed 's/Enter .-letter .* code: //' |
sed 's/ Press Return to continue, M to return to menu, X to exit: //' |
grep -v 'CITY FORECAST MENU' |
tr -d ' ' |
sed 's/ *$//' |
uniq |
sed -n '/^VTEC/q; p'

View file

@ -1,27 +0,0 @@
.TH FEDEX 1
.SH NAME
fedex, ups, usps \- track shipments
.SH SYNOPSIS
.B fedex
.I tracking-number
.br
.B ups
.I tracking-number
.br
.B usps
.I tracking-number
.SH DESCRIPTION
.I Fedex
writes available shipment details for the given Federal Express 12-digit
.I tracking-number
on the standard output.
.I Ups
is similar, but takes a United Parcel Service 18-digit
.IR tracking-number .
.I Usps
takes a US Post Office
.IR tracking-number .
.SH SOURCE
.B /rc/bin
.SH BUGS
Redesigns of the source website can break these programs.

View file

@ -1,40 +0,0 @@
.TH WEATHER 1
.SH NAME
weather \- print weather report
.SH SYNOPSIS
.B weather
[
.I air
] [
.I st
]
.SH DESCRIPTION
.I Weather
prints the local conditions and seven-day forecast most recently reported at the
.SM US
airport with the three-letter location identifier
.IR air .
Given a two-letter
.SM US
state abbreviation
.I st
instead,
.I weather
prints a table of
.I air
location identifiers known for
.IR st .
.PP
The arguments are mutually exclusive and case-insensitive.
If neither is given,
.I air
defaults to the value of the environment variable
.BR $weather ,
or if it is unset,
to the location identifier
.BR ewr ,
designating the Newark, NJ, airport near Bell Labs, Murray Hill.
.SH SOURCE
.B /rc/bin/weather
.SH BUGS
Weather is hopelessly provincial.