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=======================================================================
+++ /dev/null
-#!/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 = <STDIN>;
- last if $expr =~ /^q/i;
-
- chomp $expr;
-
- my @out = map {"$_\n"} &$dxproc({priv=>0,call=>'GDX'}, $expr);
- shift @out; # remove return code
- print @out;
-}
-
--- /dev/null
+#!/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 = <STDIN>;
+ 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);
+