summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-07-31 18:30:33 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-07-31 18:30:33 +0200
commitdc62ee73443a3259f696c059c3888cce6b06bffd (patch)
tree9e8f324fc596ce3f9967100b70bea4fd6d9266df
parentc8a7e878d92ebbe2872881adc1524ccd469ae3d5 (diff)
Fix --exclude argument validation
-rwxr-xr-xbin/efa8
-rw-r--r--test/50-efa.t2
2 files changed, 5 insertions, 5 deletions
diff --git a/bin/efa b/bin/efa
index 1062a5e..b96d7d4 100755
--- a/bin/efa
+++ b/bin/efa
@@ -147,20 +147,20 @@ sub opt_exclude {
zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus
schnellbus seilbahn schiff ast sonstige
/;
- my $ok = 0;
my (undef, $str) = @_;
my @exclude = split(/,/, $str);
foreach my $exclude_type (@exclude) {
+ my $ok = 0;
for my $map_id (0 .. $#mapping) {
if ($exclude_type eq $mapping[$map_id]) {
$post{"inclMOT_$map_id"} = undef;
$ok = 1;
}
}
- }
- if (not $ok) {
- die("exclude: Invalid argument.\n");
+ if (not $ok) {
+ die("exclude: Invalid argument: $exclude_type\n");
+ }
}
}
diff --git a/test/50-efa.t b/test/50-efa.t
index 0c1d7ab..5582e47 100644
--- a/test/50-efa.t
+++ b/test/50-efa.t
@@ -14,7 +14,7 @@ my $EMPTY = '';
my $re_usage = qr{Insufficient to/from arguments, see \S*efa --help for usage};
my $re_version = qr{\S*efa version \S+};
-my $err_exclude = "exclude: Invalid argument.\n";
+my $err_exclude = "exclude: Invalid argument: invalid\n";
my $err_prefer = "prefer: Invalid argument. Use speed|nowait|nowalk\n";
my $err_include = "include: Invalid argument. Use local|ic|ice\n";
my $err_time = "time: Invalid argument. Use HH:MM\n";