From bca8045e15c2373196634be46eef4a93029c8417 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 13 Jan 2023 07:57:20 +0000 Subject: script/*: shorten and point to docs 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... --- script/mwrap-decode-csv | 1 - script/mwrap-perl | 23 ++++++++--------------- script/mwrap-rproxy | 2 +- 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 # License: GPL-3.0+ -# 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 # License: GPL-3.0+ 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 # License: GPL-3.0+ -# 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); -- cgit v1.2.3-24-ge0c7