renamed gdx.pl as showdx
authordjk <djk>
Sat, 1 Jan 2000 14:47:20 +0000 (14:47 +0000)
committerdjk <djk>
Sat, 1 Jan 2000 14:47:20 +0000 (14:47 +0000)
Changes
perl/gdx.pl [deleted file]
perl/showdx [new file with mode: 0755]

diff --git a/Changes b/Changes
index cae5201fdf61848cdef1325126e63622b476dd64..eeb6a55313669eea511fb1c8b00d09c30183ad87 100644 (file)
--- 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 (executable)
index f88761a..0000000
+++ /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 = <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;
-}
-
diff --git a/perl/showdx b/perl/showdx
new file mode 100755 (executable)
index 0000000..9af8f41
--- /dev/null
@@ -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 = <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);
+