summaryrefslogtreecommitdiff
path: root/utils
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-29 15:47:20 -0700
commit2f9949c8d0401557c9ca1679fb1d01948fb88b68 (patch)
treebee2f71aea4ca2b4042d8642ae0a14a5bb4724e4 /utils
parentda8234d25346b60fe091a741d1fdbff9e78b6b51 (diff)
downloadsyslinux-2f9949c8d0401557c9ca1679fb1d01948fb88b68.tar.gz
bin2hex: actually account for the number of bytes written
Unlike C, in Perl printf() doesn't return the number of bytes written. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'utils')
-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;