From: Ian Jackson Date: Wed, 17 Dec 2014 16:31:37 +0000 (+0000) Subject: xlog: Proper argument parser in record (no functional change) X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?p=modbot-ulm.git;a=commitdiff_plain;h=2d4e5294848b9a94620f5d1c1b076b0e799707b7 xlog: Proper argument parser in record (no functional change) Signed-off-by: Ian Jackson --- diff --git a/xlog/bin/record b/xlog/bin/record index 2e9bc70..2408833 100755 --- a/xlog/bin/record +++ b/xlog/bin/record @@ -8,12 +8,20 @@ our %f; my $publish_rejections_patfile= '/dev/null'; my $publish_rejections= 0; -if ($ARGV[0] eq '-P') { - $publish_rejections= 1; - shift @ARGV; -} elsif ($ARGV[0] =~ s/^\-P//) { - $publish_rejections= 1; - $publish_rejections_patfile= shift @ARGV; + +for (;;) { + last unless @ARGV; + last unless $ARGV[0] =~ m/^-/; + $_ = shift @ARGV; + last if m/^--?$/; + while (m/^-./) { + if (s/^-P(.*)$//) { + $publish_rejections= 1; + $publish_rejections_patfile= $1 if length $1; + } else { + die "bad option $_ ?"; + } + } } our ($how) = @_;