ソースを参照

dpkg-architecture: Move -L actual code close to the other commands

We can do this now that the variables initialized are performed on
demand, so that we can request no variables at all. This makes the
code more consistent on when to act on the given commands.
Guillem Jover 12 年 前
コミット
ac00888ad6
共有1 個のファイルを変更した6 個の追加9 個の削除を含む
  1. 6 9
      scripts/dpkg-architecture.pl

+ 6 - 9
scripts/dpkg-architecture.pl

@@ -67,13 +67,6 @@ sub usage {
     . "\n", $Dpkg::PROGNAME;
 }
 
-sub list_arches()
-{
-    foreach my $arch (get_valid_arches()) {
-	print "$arch\n";
-    }
-}
-
 sub check_arch_coherency
 {
     my ($arch, $gnu_type) = @_;
@@ -204,8 +197,8 @@ while (@ARGV) {
        $action = 'c';
        last;
     } elsif (m/^-L$/) {
-        list_arches();
-        exit unless @ARGV;
+        $req_vars = 0;
+        $action = 'L';
     } elsif (m/^-(?:\?|-help)$/) {
         usage();
        exit 0;
@@ -339,4 +332,8 @@ if ($action eq 'l') {
     exec @ARGV;
 } elsif ($action eq 'q') {
     print "$v{$req_variable_to_print}\n";
+} elsif ($action eq 'L') {
+    foreach my $arch (get_valid_arches()) {
+       print "$arch\n";
+    }
 }