Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Aug 2000 09:24:27 +0200
From:      Sheldon Hearn <sheldonh@uunet.co.za>
To:        Will Andrews <will@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: ports/Tools/scripts addport 
Message-ID:  <4689.965633067@axl.ops.uunet.co.za>
In-Reply-To: Your message of "Sat, 05 Aug 2000 19:51:31 MST." <200008060251.TAA91609@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help


On Sat, 05 Aug 2000 19:51:31 MST, Will Andrews wrote:

>   Log:
>   Fix special case where people use ``.'' for the argument to -d.  I'm not
>   very good with perl yet, so anyone who can propose a better way to do
>   this [...]

You mean like this? :-)

Ciao,
Sheldon.

Index: addport
===================================================================
RCS file: /home/ncvs/ports/Tools/scripts/addport,v
retrieving revision 1.4
diff -u -d -r1.4 addport
--- addport	2000/08/06 02:51:30	1.4
+++ addport	2000/08/07 07:23:48
@@ -12,6 +12,7 @@
 # however feel free to submit patches to will@FreeBSD.org.  =)
 #
 
+use Cwd "abs_path";
 use Getopt::Std;
 use vars qw/ $opt_d $opt_h $opt_n $opt_u $opt_t $opt_v /;
 use strict;
@@ -168,13 +169,7 @@
 }
 
 # account for special case
-if ($dir eq ".") {
-	chomp(local $pwd = `pwd`);
-	$dir = `basename $pwd`;
-}
-
-$dir = "$pwd/$dir" if ($dir !~ m,^/,);
-$dir =~ s,/$,,g;
+$dir = abs_path($dir);
 
 if (! -d "$dir") {
 	errx(1,"$dir is either not a directory or does not exist");


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4689.965633067>