瀏覽代碼

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";
+    }
 }