bbabble
changeset 4 fda11de1826e
parent 0 648bde652211
child 5 f41d45fe7ae9
--- a/bbabble	Wed Jul 07 13:29:02 2010 -0400
+++ b/bbabble	Tue Sep 14 13:34:39 2010 -0400
@@ -2,9 +2,9 @@
 #======================================================================
 #                    B B A B B L E 
 #                    doc: Thu Mar 11 01:00:51 2004
-#                    dlm: Wed Dec  6 10:12:50 2006
+#                    dlm: Thu Aug 26 19:11:05 2010
 #                    (c) 2004 A.M. Thurnherr
-#                    uE-Info: 145 46 NIL 0 0 72 10 2 8 NIL ofnI
+#                    uE-Info: 246 21 NIL 0 0 72 10 2 8 NIL ofnI
 #======================================================================
 
 # Broad Band Babble --- talk to 1--2 RDI ADCPs
@@ -44,12 +44,19 @@
 #  Nov 14, 2006: - added ^B (baud-rate handling)
 #		 - changes to task syncronization
 #		 - replace unprintable chars by ? while in ECHO mode (only!)
+#  Aug 26, 2010: - added -y)modem receive
 
 #----------------------------------------------------------------------
 # USAGE
 #----------------------------------------------------------------------
 
-# bbabble [-m)onochrome] [-s)uppress async ouput] tty1 [tty2]
+use Getopt::Std;
+
+$USAGE = "Usage: $0 [-m)onochrome] [-s)uppress async output] " .
+		   "[-y)modem receive <cmd>] " .
+		    "<tty0_device> [tty1_device]\n";
+
+die($USAGE) unless (getopts("msy:"));
 
 # bbabble is started with 1 or 2 arguments, which are tty special files.
 # On LINUX, /dev/ttyS0 is com1: /dev/ttyS1 is com2: /dev/ttyUSB0 is the
@@ -234,11 +241,19 @@
 # It does not have its own manpage but is described in the man page of
 # `rz' (the zmodem receiver). To make matters worse, In the man page
 # the prgram is always called `rb', even on systems where the executable
-# is `lrb'. 
+# is `lrb'.
+# If -y is not given, bbabble trys to find one of the standard ymodem
+# executables. Using -y allows options to be set.
 
-chomp($receive_ymodem = `which lrb 2>/dev/null`);
-chomp($receive_ymodem = `which  rb 2>/dev/null`) if ($receive_ymodem eq '');
-die("$0: cannot find rb or lrb\n") if ($receive_ymodem eq '');
+if (defined($opt_y)) {
+	$receive_ymodem = $opt_y;
+} else {
+	chomp($receive_ymodem = `which lrb 2>/dev/null`);
+	chomp($receive_ymodem = `which	rb 2>/dev/null`)
+		if ($receive_ymodem eq '');
+	die("$0: cannot find rb or lrb\n")
+		if ($receive_ymodem eq '');
+}
 
 # When uploading command files, each command is sent after a prompt
 # is received from the instrument. The following variable defines the
@@ -253,14 +268,8 @@
 use threads;
 use threads::shared;
 use IO::Handle;
-use Getopt::Std;
 use POSIX ();
 
-$USAGE = "Usage: $0 [-m)onochrome] [-s)uppress async output] " .
-		    "<tty0_device> [tty1_device]\n";
-
-die($USAGE) unless (getopts("ms"));
-
 if (scalar(@ARGV) == 1) {
   $TTY0 = $ARGV[0];
 } elsif (scalar(@ARGV) == 2) {