summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2018-11-13 22:47:03 -0800
committerH. Peter Anvin <hpa@zytor.com>2018-11-13 22:47:03 -0800
commitb28668b5916fa3b0a9a52376a8f08f3bce9464e2 (patch)
tree2d9d3ab433a73bbc4129988746692165b47fa266
parent7061af4bdaaa59092babf538873de51da3fb17cc (diff)
downloadballot-b28668b5916fa3b0a9a52376a8f08f3bce9464e2.tar.gz
ballot-b28668b5916fa3b0a9a52376a8f08f3bce9464e2.tar.xz
ballot-b28668b5916fa3b0a9a52376a8f08f3bce9464e2.zip
csvconv.pl: print line numbers on error messages
-rwxr-xr-xbin/csvconv.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/csvconv.pl b/bin/csvconv.pl
index 554e561..5741f54 100755
--- a/bin/csvconv.pl
+++ b/bin/csvconv.pl
@@ -90,18 +90,20 @@ sub read_csv($) {
chomp $line;
@header = split(',', $line);
my $n = 0;
+ my $nline = 0;
while (defined($line = <$csv>)) {
chomp $line;
+ $nline++;
my @dline = split(',', $line);
$dline[0] =~ s/^\[\'(.*)\'\]$/\1/;
if ($dline[1] ne $global_id) {
- error("$file: Not counting incorrect survey ID: $dline[1]\n");
+ error("$file:$nline: Not counting incorrect survey ID: $dline[1]\n");
next;
} elsif (!defined($valid_ids{$dline[0]})) {
- error("$file: Not counting nonexistent ballot ID: $dline[0]\n");
+ error("$file:$nline: Not counting nonexistent ballot ID: $dline[0]\n");
next;
} elsif ($valid_ids{$dline[0]}++) {
- error("$file: Not counting duplicate ballot ID: $dline[0]\n");
+ error("$file:$nline: Not counting duplicate ballot ID: $dline[0]\n");
next;
}