harish badrinath wrote:

> According to dpkg-parsechangelog --help and man  dpkg-parsechangelog,
> dpkg-parsechangelog -l changelog is supposed to parse the file changelog.
> Instead i get "dpkg-parsechangelog: unknown option `-l'".

Thanks.  Patch to demonstrate the problem follows.  Completely
untested and the coding style feels unnecessarily repetitive (isn't
this what getopt is for?).  Please feel free to pick this up, tweak to
taste, and resend with whatever changes you deem appropriate if you
like it.

diff --git i/scripts/dpkg-parsechangelog.pl w/scripts/dpkg-parsechangelog.pl
index 2ab76089..30bb7078 100755
--- i/scripts/dpkg-parsechangelog.pl
+++ w/scripts/dpkg-parsechangelog.pl
@@ -75,27 +75,48 @@ parser options:
 while (@ARGV) {
     last unless $ARGV[0] =~ m/^-/;
     $_ = shift(@ARGV);
-    if (m/^-L(.+)$/) {
-       $options{"libdir"} = $1;
+    if (m/^-L(.*)$/) {
+       if ($1 ne "") {
+           $options{"libdir"} = $1;
+       } elsif (@ARGV) {
+           $options{"libdir"} = shift(@ARGV);
+       } else {
+           usageerr(_g("missing argument to option '%s'"), "-L");
+       }
     } elsif (m/^-F([0-9a-z]+)$/) {
        $options{"changelogformat"} = $1;
-    } elsif (m/^-l(.+)$/) {
-       $options{"file"} = $1;
+    } elsif (m/^-l(.*)$/) {
+       if ($1 ne "") {
+           $options{"file"} = $1;
+       } elsif (@ARGV) {
+           $options{"file"} = shift(@ARGV);
+       } else {
+           usageerr(_g("missing argument to option '%s'"), "-l");
+       }
     } elsif (m/^--$/) {
        last;
     } elsif (m/^-([cfnostuv])(.*)$/) {
+       my $val;
+       if ($2 ne "") {
+           $val = $2;
+       } elsif (@ARGV) {
+           $val = shift(@ARGV);
+       } else {
+           usageerr(_g("missing argument to option '%s'"), "-$1");
+       }
+
        if (($1 eq "c") or ($1 eq "n")) {
-           $options{"count"} = $2;
+           $options{"count"} = $val;
        } elsif ($1 eq "f") {
-           $options{"from"} = $2;
+           $options{"from"} = $val;
        } elsif ($1 eq "o") {
-           $options{"offset"} = $2;
+           $options{"offset"} = $val;
        } elsif (($1 eq "s") or ($1 eq "v")) {
-           $options{"since"} = $2;
+           $options{"since"} = $val;
        } elsif ($1 eq "t") {
-           $options{"to"} = $2;
+           $options{"to"} = $val;
        } elsif ($1 eq "u") {
-           $options{"until"} = $2;
+           $options{"until"} = $val;
        }
     } elsif (m/^--(count|file|format|from|offset|since|to|until)(.*)$/) {
        if ($2) {



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to