Explorar o código

dpkg: Change --print-foreign-architectures to print an entry per line

Printing just a line with space separated entries makes both the code
to print and to parse slightly more complicated. The worst part comes
from parsing as the standard stream input operations require delimited
buffers, and as such if those buffers would not be enough truncation
would happen.
Guillem Jover %!s(int64=14) %!d(string=hai) anos
pai
achega
e5dbbbb677
Modificáronse 2 ficheiros con 4 adicións e 6 borrados
  1. 2 2
      man/dpkg.1
  2. 2 4
      src/enquiry.c

+ 2 - 2
man/dpkg.1

@@ -1,4 +1,4 @@
-.TH dpkg 1 "2011-08-14" "Debian Project" "dpkg suite"
+.TH dpkg 1 "2011-11-27" "Debian Project" "dpkg suite"
 .SH NAME
 .SH NAME
 dpkg \- package manager for Debian
 dpkg \- package manager for Debian
 .
 .
@@ -236,7 +236,7 @@ reason still haven't been installed.
 Print architecture of packages \fBdpkg\fP installs (for example, "i386").
 Print architecture of packages \fBdpkg\fP installs (for example, "i386").
 .TP
 .TP
 .B \-\-print\-foreign\-architectures
 .B \-\-print\-foreign\-architectures
-Print a space-separated list of the extra architectures \fBdpkg\fP is
+Print a newline-separated list of the extra architectures \fBdpkg\fP is
 configured to allow packages to be installed for.
 configured to allow packages to be installed for.
 .TP
 .TP
 .B \-\-compare\-versions \fIver1 op ver2\fP
 .B \-\-compare\-versions \fIver1 op ver2\fP

+ 2 - 4
src/enquiry.c

@@ -480,7 +480,6 @@ int
 print_foreign_arches(const char *const *argv)
 print_foreign_arches(const char *const *argv)
 {
 {
   struct dpkg_arch *arch;
   struct dpkg_arch *arch;
-  const char *sep = "";
 
 
   if (*argv)
   if (*argv)
     badusage(_("--%s takes no arguments"), cipaction->olong);
     badusage(_("--%s takes no arguments"), cipaction->olong);
@@ -488,10 +487,9 @@ print_foreign_arches(const char *const *argv)
   for (arch = dpkg_arch_get_list(); arch; arch = arch->next) {
   for (arch = dpkg_arch_get_list(); arch; arch = arch->next) {
     if (arch->type != arch_foreign)
     if (arch->type != arch_foreign)
       continue;
       continue;
-    printf("%s%s", sep, arch->name);
-    sep = " ";
+
+    printf("%s\n", arch->name);
   }
   }
-  printf("\n");
 
 
   m_output(stdout, _("<standard output>"));
   m_output(stdout, _("<standard output>"));