Add option to compare ballot to sample ballot.

It may be desriable to compare a ballot to
a sample ballot when checking votes.

* Add options "diff" and "sampleballotfile" to
  usevote.cfg an UVconfig.pm
* Add menu option to UVmenu.pm

Picked from upstream.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2014-02-16 13:33:47 +01:00
parent dc651b4283
commit 7a0133efe6
6 changed files with 42 additions and 6 deletions

View file

@ -70,6 +70,12 @@ sub menu {
my $menucaption = UVmessage::get("MENU_CAPTION");
print "\n\n$menucaption\n";
print "=" x length($menucaption), "\n\n";
# don't print this option if called from uvcfv.pl
unless ($mailonly) {
print "(0) ", UVmessage::get("MENU_DIFF_BALLOT"), "\n";
}
print "(1) ", UVmessage::get("MENU_SHOW_MAIL"), "\n\n",
UVmessage::get("MENU_CHANGE_PROPERTIES"), "\n",
"(2) ", UVmessage::get("MENU_ADDRESS"), " [$voter_addr]\n";
@ -96,7 +102,14 @@ sub menu {
# only accept 1, 2, i and w if called from uvcfv.pl
next if ($mailonly && $input !~ /^[12iw]$/i);
if ($input eq '1') {
if ($input eq '0') {
# ignore SIGPIPE (Bug in more and less)
$SIG{PIPE} = 'IGNORE';
open (DIFF, "|$config{diff} - $config{sampleballotfile} | $config{pager}");
print DIFF $$body, "\n";
close (DIFF);
} elsif ($input eq '1') {
system($config{clearcmd});
# ignore SIGPIPE (Bug in more and less)
$SIG{PIPE} = 'IGNORE';