From: djk Date: Sat, 1 Jan 2000 14:47:20 +0000 (+0000) Subject: renamed gdx.pl as showdx X-Git-Tag: R_1_38~2 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b68c016b1907375bfad28d762daa49df7b93f5d;p=spider.git renamed gdx.pl as showdx --- diff --git a/Changes b/Changes index cae5201f..eeb6a553 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ as I do!). 2. updated gdx.pl so that external programs can do a sh/dx just as a normal user can. On reflection this could be used as a model for all sorts of "external" interface routines. +3. renamed gdx.pl as showdx. 11Dec99======================================================================= 1. added missing pc48 so that it calls the DXDb::process routine 10Dec99======================================================================= diff --git a/perl/gdx.pl b/perl/gdx.pl deleted file mode 100755 index f88761ab..00000000 --- a/perl/gdx.pl +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl -# -# grep for expressions in various fields of the dx file -# - -# 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; - -$dxdir = "/spider/cmd/show"; -$dxcmd = "dx.pl"; -$s = readfilestr($dxdir, $dxcmd); -$dxproc = eval "sub { $s }"; -die $@ if $@; - -STDOUT->autoflush(1); -Spot::init(); -Bands::load(); - -for (;;) { - print "expr: "; - $expr = ; - last if $expr =~ /^q/i; - - chomp $expr; - - my @out = map {"$_\n"} &$dxproc({priv=>0,call=>'GDX'}, $expr); - shift @out; # remove return code - print @out; -} - diff --git a/perl/showdx b/perl/showdx new file mode 100755 index 00000000..9af8f41b --- /dev/null +++ b/perl/showdx @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# +# Implement an external "show/dx" command +# +# Copyright (c) 1998-2000 Dirk Koopman G1TLH +# +# $Id$ +# + +# 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; + +$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({priv=>0,call=>'GDX'}, $myexpr); + shift @out; # remove return code + print @out; + last if $expr; +} +exit(0); +