diff options
| author | Jo-Philipp Wich | 2022-08-30 16:20:04 +0000 |
|---|---|---|
| committer | Petr Štetiar | 2022-09-16 16:50:46 +0000 |
| commit | 4c795af58b06b23a8caddf219c56ce021a590fdb (patch) | |
| tree | 2c6a665835bb4431f8a396ddba61c6b744b0933a | |
| parent | a352e30b8f23a38f60289d2d091b4b57f0f56d19 (diff) | |
| download | openwrt-4c795af58b06b23a8caddf219c56ce021a590fdb.tar.gz | |
scripts: xxdi.pl: remove File::Slurp dependency
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)
| -rwxr-xr-x | scripts/xxdi.pl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/scripts/xxdi.pl b/scripts/xxdi.pl index acc974c4b3..1f960902be 100755 --- 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; |