From owner-cvs-all Mon Aug 7 0:24:39 2000 Delivered-To: cvs-all@freebsd.org Received: from axl.ops.uunet.co.za (axl.ops.uunet.co.za [196.31.2.163]) by hub.freebsd.org (Postfix) with ESMTP id C637237BD1A; Mon, 7 Aug 2000 00:24:29 -0700 (PDT) (envelope-from sheldonh@axl.ops.uunet.co.za) Received: from sheldonh (helo=axl.ops.uunet.co.za) by axl.ops.uunet.co.za with local-esmtp (Exim 3.16 #1) id 13LhGt-0001De-00; Mon, 07 Aug 2000 09:24:27 +0200 From: Sheldon Hearn To: Will Andrews Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: ports/Tools/scripts addport In-reply-to: Your message of "Sat, 05 Aug 2000 19:51:31 MST." <200008060251.TAA91609@freefall.freebsd.org> Date: Mon, 07 Aug 2000 09:24:27 +0200 Message-ID: <4689.965633067@axl.ops.uunet.co.za> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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