diff options
| author | H. Peter Anvin <hpa@zytor.com> | 2009-05-29 15:47:20 -0700 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2009-05-31 21:53:18 -0700 |
| commit | ba03136d0d40bf219b4923855a3a2b20c03babd7 (patch) | |
| tree | b4671dd024c01c5c11772c93ad1971d5373e5568 | |
| parent | 2f92affcce5ffef4da90fe44bcac5a4db45df25f (diff) | |
| download | syslinux-3.82-pre3.tar.gz | |
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.pl | 7 |
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; |
