Don't croak on port names that contain metacharacters.

This commit is contained in:
Dag-Erling Smørgrav 2004-10-22 13:50:12 +00:00
parent 2fc7b55c07
commit f15952d8a2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=119971
4 changed files with 12 additions and 8 deletions

View file

@ -8,7 +8,7 @@
#
PORTNAME= porteasy
PORTVERSION= 2.7.18
PORTVERSION= 2.7.19
CATEGORIES= misc
MASTER_SITES= # none
DISTFILES= # none

View file

@ -33,7 +33,7 @@ use strict;
use Fcntl;
use Getopt::Long;
my $VERSION = "2.7.18";
my $VERSION = "2.7.19";
my $COPYRIGHT = "Copyright (c) 2000-2004 Dag-Erling Smørgrav. " .
"All rights reserved.";
@ -422,8 +422,10 @@ sub find_port($) {
my @suggest; # Suggestions
stderr("Can't find required port '$port'");
@suggest = grep(/^$port/i, keys(%ports));
if (@suggest == 1 && $suggest[0] =~ m/^$port[0-9.-]/) {
my $portre = $port;
$portre =~ s/([^\w])/\\$1/g;
@suggest = grep(/^$portre/i, keys(%ports));
if (@suggest == 1 && $suggest[0] =~ m/^$portre[0-9.-]/) {
$port = $ports{$suggest[0]};
stderr(", assuming you mean $pkgname{$port}.\n");
return $port;

View file

@ -8,7 +8,7 @@
#
PORTNAME= porteasy
PORTVERSION= 2.7.18
PORTVERSION= 2.7.19
CATEGORIES= misc
MASTER_SITES= # none
DISTFILES= # none

View file

@ -33,7 +33,7 @@ use strict;
use Fcntl;
use Getopt::Long;
my $VERSION = "2.7.18";
my $VERSION = "2.7.19";
my $COPYRIGHT = "Copyright (c) 2000-2004 Dag-Erling Smørgrav. " .
"All rights reserved.";
@ -422,8 +422,10 @@ sub find_port($) {
my @suggest; # Suggestions
stderr("Can't find required port '$port'");
@suggest = grep(/^$port/i, keys(%ports));
if (@suggest == 1 && $suggest[0] =~ m/^$port[0-9.-]/) {
my $portre = $port;
$portre =~ s/([^\w])/\\$1/g;
@suggest = grep(/^$portre/i, keys(%ports));
if (@suggest == 1 && $suggest[0] =~ m/^$portre[0-9.-]/) {
$port = $ports{$suggest[0]};
stderr(", assuming you mean $pkgname{$port}.\n");
return $port;