From f4859e129d3631904bc13ae2aa8e852e91af97cc Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Mon, 10 Aug 2009 16:52:36 -0400 Subject: [PATCH] added error messages for file not found. Signed-off-by: Mariano Alvira --- mc1322x-load.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mc1322x-load.pl b/mc1322x-load.pl index f545ad89d..361e26327 100755 --- a/mc1322x-load.pl +++ b/mc1322x-load.pl @@ -18,7 +18,7 @@ GetOptions ('file=s' => \$filename, 'terminal=s' => \$term, 'verbose' => \$verbose, 'baud=s' => \$baud, - ); + ) or die 'bad options'; $| = 1; @@ -34,11 +34,12 @@ if($filename eq '') { exit; } +if (!(-e $filename)) { die "file $filename not found\n"; } +if (($second ne '') && !(-e $second)) { die "secondary file $second not found\n"; } + my $ob = Device::SerialPort->new ($term) or die "Can't start $term\n"; # next test will die at runtime unless $ob -if ($filename eq '') { die "you must specify a file with -f\n"; } - $ob->baudrate($baud); $ob->parity('none'); $ob->databits(8);