about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-13 07:57:20 +0000
committerEric Wong <mwrap-perl@80x24.org>2023-01-13 07:56:13 +0000
commitbca8045e15c2373196634be46eef4a93029c8417 (patch)
tree8bf04bc309877e3f06068c9750ffb42818df8952
parent0295f1f53fdcfa7f6cd6696525325f3d12f6a660 (diff)
downloadmwrap-bca8045e15c2373196634be46eef4a93029c8417.tar.gz
Try to keep these scripts as short as possible so it's easier to
find the manpage.  For -rproxy, I guess a small note at the top
will have to do...
-rw-r--r--script/mwrap-decode-csv1
-rw-r--r--script/mwrap-perl23
-rw-r--r--script/mwrap-rproxy2
3 files changed, 9 insertions, 17 deletions
diff --git a/script/mwrap-decode-csv b/script/mwrap-decode-csv
index 5bbc171..ad73b8c 100644
--- a/script/mwrap-decode-csv
+++ b/script/mwrap-decode-csv
@@ -1,7 +1,6 @@
 #!perl -w
 # Copyright (C) mwrap hackers <mwrap-perl@80x24.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
-# addr2line decoder for the output of MWRAP=dump_csv:$FILENAME
 use v5.12;
 use Devel::Mwrap::Rproxy;
 use IO::Handle;
diff --git a/script/mwrap-perl b/script/mwrap-perl
index c9a5666..632deaf 100644
--- a/script/mwrap-perl
+++ b/script/mwrap-perl
@@ -1,24 +1,17 @@
-#!/usr/bin/perl -w
+#!perl -w
 # Copyright (C) mwrap hackers <mwrap-perl@80x24.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 use v5.12;
 use Devel::Mwrap;
-my ($so) = grep(m!/Mwrap\.so\z!, @DynaLoader::dl_shared_objects);
-defined($so) or die 'Mwrap.so not loaded';
-my $cur = $ENV{LD_PRELOAD};
+my ($so) = grep(m!/Mwrap\.so\z!, @DynaLoader::dl_shared_objects)
+        or die 'Mwrap.so not loaded';
 if (!@ARGV || ($ARGV[0] // '') =~ /\A(?:-h|--help)\z/) {
-        require Pod::Usage;
-        Pod::Usage::pod2usage(@ARGV ? 0 : 1);
+        require Pod::Usage; Pod::Usage::pod2usage(@ARGV ? 0 : 1);
 }
-if (defined $cur) {
-        my @cur = split(/[: \t]+/, $cur);
-        if (!grep(/\A\Q$so\E\z/, @cur)) {
-                # drop old redundant versions
-                my @keep = grep(!m!/Mwrap\.so$!, @cur);
-                $ENV{LD_PRELOAD} = join(':', $so, @keep);
-        }
-} else {
-        $ENV{LD_PRELOAD} = $so;
+my @cur = split(/[: \t]+/, $ENV{LD_PRELOAD} // '');
+if (!grep(/\A\Q$so\E\z/, @cur)) { # drop old redundant versions
+        my @keep = grep(!m!/Mwrap\.so$!, @cur);
+        $ENV{LD_PRELOAD} = join(':', $so, @keep);
 }
 exec @ARGV;
 __END__
diff --git a/script/mwrap-rproxy b/script/mwrap-rproxy
index 056e80a..57fdde7 100644
--- a/script/mwrap-rproxy
+++ b/script/mwrap-rproxy
@@ -1,7 +1,7 @@
 #!perl -w
 # Copyright (C) mwrap hackers <mwrap-perl@80x24.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
-# thin wrapper for Devel::Mwrap::Rproxy
+# thin wrapper for Devel::Mwrap::Rproxy (see __END__ below for manpage)
 use v5.12; # strict
 eval { require Plack::Runner } or die "Plack not installed: $@\n";
 use Getopt::Long qw(:config no_ignore_case no_auto_abbrev pass_through);