#!/usr/bin/perl # # Implement an external "show/dx" command # # Copyright (c) 1998-2000 Dirk Koopman G1TLH # # search local then perl directories BEGIN { # root of directory tree for this system $root = "/spider"; $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'}; unshift @INC, "$root/perl"; # this IS the right way round! unshift @INC, "$root/local"; } use IO::Handle; use DXUtil; use Bands; use Spot; use VE7CC; $dxdir = "/spider/cmd/show"; $dxcmd = "dx.pl"; $s = readfilestr($dxdir, $dxcmd); $dxproc = eval "sub { $s }"; die $@ if $@; STDOUT->autoflush(1); Spot::init(); Bands::load(); $expr = join ' ', @ARGV if @ARGV; for (;;) { if ($expr) { $myexpr = $expr; } else { print "show/dx: "; $myexpr = ; last unless defined $myexpr; chomp $myexpr; last if $myexpr =~ /^q$/i; } my @out = map {"$_\n"} &$dxproc(undef, $myexpr); shift @out; # remove return code print @out; last if $expr; } exit(0);