aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-08-30 18:20:04 +0200
committerPetr Štetiar <ynezz@true.cz>2022-09-21 11:52:40 +0200
commit70124b8579b1c43c9018352adf8e87e1246843c7 (patch)
tree5621d7790115e6d6509cc4c96b8d67dd50cf92aa
parent4e221757c45fa94bfbd191726bfdc5655e61c31d (diff)
downloadupstream-70124b8579b1c43c9018352adf8e87e1246843c7.tar.gz
upstream-70124b8579b1c43c9018352adf8e87e1246843c7.tar.bz2
upstream-70124b8579b1c43c9018352adf8e87e1246843c7.zip
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-xscripts/xxdi.pl19
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;