#!/bin/rc
# lucent web proxy caches the page; defeat it
rfork n
if(! ~ $#* 1) {
echo usage: ups 1ZA41W190338680961 >[1=2]
exit usage
}
rfork e
hget 'http://wwwapps.ups.com/etracking/tracking.cgi?track=Track&InquiryNumber1='^$1^ \
'&TypeOfInquiryNumber=T' >/tmp/ups.1
cat /tmp/ups.1 |
x=`{sed -n 's/^<INPUT TYPE="HIDDEN" NAME="([^"]+)" VALUE="([^"]+)">.*/\1=\2/p' |
tr ' ' ++}
x=$"x
x=`{echo $x | sed 's/ /\&/g'}
x=$"x
x=$x^'&tdts1.x=19&tdts1.y=7'
hget -p $x http://wwwapps.ups.com/etracking/tracking.cgi >/tmp/ups.2
sed 's/<[Tt][Dd]>/& «TD»/g; s/<[Tt][Rr]>/&<td> «TR» /g' /tmp/ups.2 |
htmlfmt >/tmp/ups.3
sam -d /tmp/ups.3 >[2] /dev/null <<'!'
/^Tracking results.*/p
.,$d
/View Details/d
1,.d
,s/\n/ /g
,s/«TR»/\n/g
,s/«TD»/ /g
,s/ * */ /g
,s/^[ ]*//g
,s/[ ]*$//g
,s/\n\n+/\n\n/g
,p
!
|