1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-07-01 02:39:49 +03:00

ds-catq.pl: allow selecting multiple values and added a test mode.

- boom/dist/dk/dk-catq.pl: allow multiple values of a parameter to be
  selected
- boom/dist/dk/dk-catq.pl: new option -t to run in test mode, in which the
  resulting pages are not downloaded but only the URL leading to them is
  printed
This commit is contained in:
Werner Almesberger 2010-10-16 10:43:39 -03:00
parent 58bca0e24e
commit 331094ec8f

View File

@ -24,6 +24,11 @@ sub query
# --- Read query specification ------------------------------------------------
if ($ARGV[0] eq "-t") {
$test = 1;
shift @ARGV;
}
$spec = $ARGV[0];
while (<>) {
@ -38,7 +43,7 @@ $key = shift @q;
$cat = shift @q;
for (@q) {
die "not a field=value pair: \"$_\"" unless /\s*=\s*/;
$f{$`} = $';
push(@{ $f{$`} }, $');
}
@ -91,9 +96,20 @@ for (@q) {
for (keys %f) {
$field = $col_field{$_};
die "no such field: $_" unless defined $field;
$value = $val{$_}{$f{$_}};
die "no such value: \"$_\"=\"$f{$_}\"" unless defined $value;
$url .= "&$field=$value";
for $v (@{ $f{$_} }) {
$value = $val{$_}{$v};
die "no such value: \"$_\"=\"$f{$_}\"" unless defined $value;
$url .= "&$field=$value";
}
}
# --- Stop here if in test mode -----------------------------------------------
if ($test) {
print "$url\n";
exit(0);
}