pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg/files pkgtools/url2pkg: run editor wi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/641e57389e36
branches:  trunk
changeset: 399865:641e57389e36
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Aug 18 05:32:00 2019 +0000

description:
pkgtools/url2pkg: run editor with line number only if supported

For example, ed doesn't support line numbers.

diffstat:

 pkgtools/url2pkg/files/url2pkg.pl |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 042bc3cf275f -r 641e57389e36 pkgtools/url2pkg/files/url2pkg.pl
--- a/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 05:22:17 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 05:32:00 2019 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: url2pkg.pl,v 1.45 2019/08/17 13:55:41 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.46 2019/08/18 05:32:00 rillig Exp $
 #
 
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -52,7 +52,12 @@
 
        my $editor = $ENV{"PKGEDITOR"} || $ENV{"EDITOR"} || "vi";
 
-       system { $editor } ($editor, "+${lineno}", $fname);
+       my @args;
+       push(@args, $editor);
+       push(@args, "+$lineno") if $editor =~ qr"(^|/)(mcedit|nano|pico|vi|vim)$";
+       push(@args, $fname);
+
+       system { $args[0] } (@args);
 }
 
 sub get_maintainer() {



Home | Main Index | Thread Index | Old Index