diff options
author | rillig <rillig@pkgsrc.org> | 2019-08-18 05:32:00 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2019-08-18 05:32:00 +0000 |
commit | ea8ec23d0cec71d657f009187bba45658e07140e (patch) | |
tree | 19f2e14f286f70b75b1927dc2c90a680e01cc5ee /pkgtools | |
parent | 77ed75377d3eb1dc1a437dc488cde81f419e3c6b (diff) | |
download | pkgsrc-ea8ec23d0cec71d657f009187bba45658e07140e.tar.gz |
pkgtools/url2pkg: run editor with line number only if supported
For example, ed doesn't support line numbers.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/url2pkg/files/url2pkg.pl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkgtools/url2pkg/files/url2pkg.pl b/pkgtools/url2pkg/files/url2pkg.pl index f8b161071ea..c9152bb535f 100644 --- a/pkgtools/url2pkg/files/url2pkg.pl +++ b/pkgtools/url2pkg/files/url2pkg.pl @@ -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 @@ sub run_editor($$) { 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() { |