aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-01-14 19:22:21 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-01-14 19:23:04 -0800
commitcc8ee5ab96af8bb55d937d4e9dd92ebef110f707 (patch)
treed4edbb9bc1e156e9fd8818c2bc24ec281f13fa9a
parent1ab6e7fc8a76bf68146e54c1c6a00b69955c9c9c (diff)
downloadsubsurface-cc8ee5ab96af8bb55d937d4e9dd92ebef110f707.tar.gz
Avoid duplicate entries when parsing libdivecomputer descriptors
This just fixes the tool used for the next commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rwxr-xr-xscripts/parse-descriptor.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/parse-descriptor.pl b/scripts/parse-descriptor.pl
index 26df4028a..b1729a608 100755
--- a/scripts/parse-descriptor.pl
+++ b/scripts/parse-descriptor.pl
@@ -22,6 +22,7 @@ open(my $fh, "<", $infi) || croak "can't open $infi: $!";
open(STDOUT, ">", $outfi) || croak "can't open $outfi: $!";
my $lastVend = "";
+my $lastMod = "";
my @descriptors = ();
while (<$fh>) {
if (/^\s*{\s*"([^\,]*)"\s*,\s*"([^\,]*)"\s*,\s*([^\,]*).*}/) {
@@ -31,6 +32,7 @@ while (<$fh>) {
my @sortedDescriptors = sort @descriptors;
foreach (@sortedDescriptors) {
($vend, $mod) = split(',', $_);
+ next if ($vend eq $lastVend && $mod eq $lastMod);
if ($type eq "html") {
if ($vend eq $lastVend) {
printf(", %s", $mod);
@@ -59,6 +61,7 @@ foreach (@sortedDescriptors) {
}
}
$lastVend = $vend;
+ $lastMod = $mod;
}
if ($type eq "html") {
print("</li>\n\t</ul>\n </dd>\n</dl>");