projects
/
openwrt
/
staging
/
hauke.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4e22175
)
scripts: xxdi.pl: remove File::Slurp dependency
author
Jo-Philipp Wich
<jo@mein.io>
Tue, 30 Aug 2022 16:20:04 +0000
(18:20 +0200)
committer
Petr Štetiar
<ynezz@true.cz>
Wed, 21 Sep 2022 09:52:40 +0000
(11:52 +0200)
In order to make it more portable.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
(cherry picked from commit
8b278a76d90e3724815a5fde32be59f7796be1d8
)
scripts/xxdi.pl
patch
|
blob
|
history
diff --git
a/scripts/xxdi.pl
b/scripts/xxdi.pl
index acc974c4b3cc8316001a28b12f41e9f581eac36f..1f960902beffd56f49ae1a378e69b6018cd0adc2 100755
(executable)
--- a/
scripts/xxdi.pl
+++ b/
scripts/xxdi.pl
@@
-14,9
+14,24
@@
use strict;
use warnings;
-use File::Slurp qw(slurp);
-my $indata = slurp(@ARGV ? $ARGV[0] : \*STDIN);
+my $indata;
+
+{
+ local $/;
+ my $fh;
+
+ if (@ARGV) {
+ open($fh, '<:raw', $ARGV[0]) || die("Unable to open $ARGV[0]: $!\n");
+ } else {
+ $fh = \*STDIN;
+ }
+
+ $indata = readline $fh;
+
+ close $fh;
+}
+
my $len_data = length($indata);
my $num_digits_per_line = 12;
my $var_name;