Просмотр исходного кода

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 лет назад: 14
Родитель
Сommit
e5dbbbb677
2 измененных файлов с 4 добавлено и 6 удалено
  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
 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").
 .TP
 .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.
 .TP
 .B \-\-compare\-versions \fIver1 op ver2\fP

+ 2 - 4
src/enquiry.c

@@ -480,7 +480,6 @@ int
 print_foreign_arches(const char *const *argv)
 {
   struct dpkg_arch *arch;
-  const char *sep = "";
 
   if (*argv)
     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) {
     if (arch->type != arch_foreign)
       continue;
-    printf("%s%s", sep, arch->name);
-    sep = " ";
+
+    printf("%s\n", arch->name);
   }
-  printf("\n");
 
   m_output(stdout, _("<standard output>"));