Explorar o código

Dpkg::ErrorHandling::usageerr: Support format strings

When changing all error reporting function to support
format strings, usageerr was apparently forgotten.
Frank Lichtenheld %!s(int64=18) %!d(string=hai) anos
pai
achega
c5a2d0121b
Modificáronse 2 ficheiros con 8 adicións e 1 borrados
  1. 4 0
      ChangeLog
  2. 4 1
      scripts/Dpkg/ErrorHandling.pm

+ 4 - 0
ChangeLog

@@ -1,5 +1,9 @@
 2007-12-04  Frank Lichtenheld  <djpig@debian.org>
 2007-12-04  Frank Lichtenheld  <djpig@debian.org>
 
 
+	* scripts/Dpkg/ErrorHandling.pm (usageerr):
+	Support format strings like all the other
+	error reporting functions.
+
 	* scripts/Makefile.am (EXTRA_DIST): Add
 	* scripts/Makefile.am (EXTRA_DIST): Add
 	missing files from scripts/t/.
 	missing files from scripts/t/.
 
 

+ 4 - 1
scripts/Dpkg/ErrorHandling.pm

@@ -80,7 +80,10 @@ sub subprocerr(@)
 
 
 sub usageerr(@)
 sub usageerr(@)
 {
 {
-    printf(STDERR "%s: %s\n\n", $progname, "@_");
+    my ($msg) = (shift);
+
+    $msg = sprintf($msg, @_) if (@_);
+    warn "$progname: $msg\n\n";
     # XXX: access to main namespace
     # XXX: access to main namespace
     main::usage();
     main::usage();
     exit(2);
     exit(2);