From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 458531F47C for ; Fri, 13 Jan 2023 07:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1673596640; bh=b8oXgu3EgBmFPqRHri8QSQFO0Dx7hB4ltVN34ZMUf9I=; h=From:To:Subject:Date:From; b=gV8jjx4ALbNN9totiiD+BE8ANQRj461JpmEC9ULHGyGaTzubgujoKB27F2aX3qSQN 4d+kroIqu4B6n1vC9U+pEaYdSJAxpk2GZZHzepSkxxO6LNObvFsh4q29ei7vA4wCVt i/weZsS8t9lWpQjOBMT8HuOigbbRphDxdM87f8mQ= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH] script/*: shorten and point to docs Date: Fri, 13 Jan 2023 07:57:20 +0000 Message-Id: <20230113075720.2857889-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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);