Quellcode durchsuchen

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 vor 12 Jahren
Ursprung
Commit
ac00888ad6
1 geänderte Dateien mit 6 neuen und 9 gelöschten Zeilen
  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";
+    }
 }