Re: Airports

Jon Stockill <[email protected]>
Newsgroups gmane.games.flightgear.terragear.devel
Message-ID <Pine.LNX.4.58.0404170943370.24443@architect.internal.stockill.org.uk>
On Thu, 15 Apr 2004, David Luff wrote:

> I'll be saving your script though - should come in handy!  I still think
> that TerraGear ought to be robust to multiple airport sources though,
> but it's not a big deal.

Don't use that version. You'll find you end up with a rather short list.

This one works though:

#!/usr/bin/perl

use strict;

my $twypath=$ARGV[0];
my $listfile=$ARGV[1]||"/usr/lib/FlightGear/Airports/runways.dat.gz";
my $field;
my $file;

open LIST,"zcat $listfile|";
open OUT,">test.dat";
while (<LIST>)
{	($field)=(/^. (.*?) /);
	next if ($file eq $field);
	if (/^A/)
	{	if (-r "$twypath/$field.twy")
		{	open INSERT,"<$twypath/$field.twy";
			while (<INSERT>)
			{	print OUT;
			};
			close INSERT;
			$file=$field;
		} else
		{	print OUT;
		};
	} else
	{	print OUT;
	};
};
close LIST;
close OUT;
exit 0;

-- 
Jon Stockill
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.