aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-29 15:47:20 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-31 21:53:18 -0700
commitba03136d0d40bf219b4923855a3a2b20c03babd7 (patch)
treeb4671dd024c01c5c11772c93ad1971d5373e5568
parent2f92affcce5ffef4da90fe44bcac5a4db45df25f (diff)
downloadsyslinux.git-ba03136d0d40bf219b4923855a3a2b20c03babd7.tar.gz
syslinux.git-ba03136d0d40bf219b4923855a3a2b20c03babd7.tar.xz
syslinux.git-ba03136d0d40bf219b4923855a3a2b20c03babd7.zip
bin2hex: actually account for the number of bytes writtensyslinux-3.82-pre3
Unlike C, in Perl printf() doesn't return the number of bytes written. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--utils/bin2hex.pl7
1 files changed, 5 insertions, 2 deletions
diff --git a/utils/bin2hex.pl b/utils/bin2hex.pl
index 0cb486e7..778b699e 100644
--- a/utils/bin2hex.pl
+++ b/utils/bin2hex.pl
@@ -26,12 +26,15 @@
##
## -----------------------------------------------------------------------
-eval { use bytes; }; eval { binmode STDIN; };
+eval { use bytes; };
+eval { binmode STDIN; };
$len = 0;
while ( read(STDIN,$ch,1) ) {
$cc = ord($ch);
- $len += printf ("%x", $cc);
+ $s = sprintf("%x", $cc);
+ print $s;
+ $len += length($s);
if ( $len > 72 ) {
print "\n";
$len = 0;