Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/bin/rc/flight

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
rfork en

flagfmt='d'
args='CO 380'

if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
	aux/usage
	exit usage
}

hget -p 'airline='^$1 -p 'flightNumber='^$2 \
	http://www.flightstats.com/go/FlightStatus/flightStatusByFlight.do |
	htmlfmt > /tmp/flight.$pid

sam -d /tmp/flight.$pid >[2] /dev/null <<'!'
0,/=======\n*/d
/Set Flight Alert/,/FlightStats Mobile!/+1d
/This flight is marketed/,/carrier\(s\):/d
/Travel Checklist/,$d
/Traffic Conditions/-1,/Traffic Report/d
/ What this\?/d
/To see/,/Extended Details/d
,s/Learn More\n//g
,s/:\n/:	/g
,s/\([ 	]/\(/g
,s/\n\n\n+/\n\n/g
,s/\n\(/\n	\(/g
,x/Current Airport Delays/ +1,+2d
,x/FAA Delays/ -3,-1d
,x/Current Weather Conditions/ +1,+2d
,x/Visibility/ +1d
w
!

if (! ~ $flagd '') {
	cat /tmp/flight.$pid
	rm /tmp/flight.$pid
	exit
}

sam -d /tmp/flight.$pid >[2] /dev/null <<'!'
/See below/,$d
,p
!

rm /tmp/flight.$pid

# /Codeshares/,/\n\n/s/^/\n/g

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.