| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #! @PERL@ | | 1 | #! @PERL@ |
2 | # $NetBSD: url2pkg.pl,v 1.45 2019/08/17 13:55:41 rillig Exp $ | | 2 | # $NetBSD: url2pkg.pl,v 1.46 2019/08/18 05:32:00 rillig Exp $ |
3 | # | | 3 | # |
4 | | | 4 | |
5 | # Copyright (c) 2010 The NetBSD Foundation, Inc. | | 5 | # Copyright (c) 2010 The NetBSD Foundation, Inc. |
6 | # All rights reserved. | | 6 | # All rights reserved. |
7 | # | | 7 | # |
8 | # This code is derived from software contributed to The NetBSD Foundation | | 8 | # This code is derived from software contributed to The NetBSD Foundation |
9 | # by Roland Illig. | | 9 | # by Roland Illig. |
10 | # | | 10 | # |
11 | # Redistribution and use in source and binary forms, with or without | | 11 | # Redistribution and use in source and binary forms, with or without |
12 | # modification, are permitted provided that the following conditions | | 12 | # modification, are permitted provided that the following conditions |
13 | # are met: | | 13 | # are met: |
14 | # 1. Redistributions of source code must retain the above copyright | | 14 | # 1. Redistributions of source code must retain the above copyright |
15 | # notice, this list of conditions and the following disclaimer. | | 15 | # notice, this list of conditions and the following disclaimer. |
| @@ -42,27 +42,32 @@ my $perllibdir = '@PERLLIBDIR@'; | | | @@ -42,27 +42,32 @@ my $perllibdir = '@PERLLIBDIR@'; |
42 | | | 42 | |
43 | use constant true => 1; | | 43 | use constant true => 1; |
44 | use constant false => 0; | | 44 | use constant false => 0; |
45 | | | 45 | |
46 | # | | 46 | # |
47 | # Some helper subroutines. | | 47 | # Some helper subroutines. |
48 | # | | 48 | # |
49 | | | 49 | |
50 | sub run_editor($$) { | | 50 | sub run_editor($$) { |
51 | my ($fname, $lineno) = @_; | | 51 | my ($fname, $lineno) = @_; |
52 | | | 52 | |
53 | my $editor = $ENV{"PKGEDITOR"} || $ENV{"EDITOR"} || "vi"; | | 53 | my $editor = $ENV{"PKGEDITOR"} || $ENV{"EDITOR"} || "vi"; |
54 | | | 54 | |
55 | system { $editor } ($editor, "+${lineno}", $fname); | | 55 | my @args; |
| | | 56 | push(@args, $editor); |
| | | 57 | push(@args, "+$lineno") if $editor =~ qr"(^|/)(mcedit|nano|pico|vi|vim)$"; |
| | | 58 | push(@args, $fname); |
| | | 59 | |
| | | 60 | system { $args[0] } (@args); |
56 | } | | 61 | } |
57 | | | 62 | |
58 | sub get_maintainer() { | | 63 | sub get_maintainer() { |
59 | | | 64 | |
60 | return $ENV{"PKGMAINTAINER"} || $ENV{"REPLYTO"} || "INSERT_YOUR_MAIL_ADDRESS_HERE"; | | 65 | return $ENV{"PKGMAINTAINER"} || $ENV{"REPLYTO"} || "INSERT_YOUR_MAIL_ADDRESS_HERE"; |
61 | } | | 66 | } |
62 | | | 67 | |
63 | sub print_section($$) { | | 68 | sub print_section($$) { |
64 | my ($f, $vars) = @_; | | 69 | my ($f, $vars) = @_; |
65 | | | 70 | |
66 | if (scalar(@{$vars}) == 0) { | | 71 | if (scalar(@{$vars}) == 0) { |
67 | return; | | 72 | return; |
68 | } | | 73 | } |