mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									1ab6e7fc8a
								
							
						
					
					
						commit
						cc8ee5ab96
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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>");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue