#!/bin/rc


rfork n
ramfs

for (i in $*){
	hget 'http://www.dnsstuff.com/tools/whois.ch?ip='^$i^'&email=on' |
		htmlfmt > /tmp/iwhois
	if ( grep -s 'Unfortunately, this domain is registered through Network Solutions' /tmp/iwhois )
		/rc/bin/iwhois $i
	if not
		sed '
			/^[#%]$/d
			/^[%#] /d
			/^$/d
			/^Found .* Looking up$/d
			/^WHOIS results for/d
			/^I was referred to /d
			/^Using [0-9]+ day old cached answer/d
			/^Generated by/d
			/^Displaying E-mail address/d
			/The Data in the Tucows Registrar/,$d
			/^--$/,$d
			/^=======$/,$d
			/^\[The following lines added by www.dnsstuff.com/,$d
		' /tmp/iwhois
}
