Properly check -d argument, and return usage() if it's not there. Also use

Sys::Hostname with hostname() instead of `hostname`.

Hostname stolen from:	CVSROOT/log_accum.pl
This commit is contained in:
Will Andrews
2000-08-11 21:44:18 +00:00
parent f38ad5ed93
commit 727770ca84
+9 -6
View File
@@ -14,17 +14,14 @@
use Cwd "abs_path";
use Getopt::Std;
use Sys::Hostname;
use strict;
my %opts;
if (getopts('d:h:intu:v', \%opts)) {
usage();
exit 1;
}
getopts('d:h:intu:v', \%opts);
my $dir = $opts{'d'};
print "dir = $dir\n";
my $h = "freefall.FreeBSD.org";
$h = $opts{'h'} if ($opts{'h'} ne "");
my $n = $opts{'n'};
@@ -48,7 +45,7 @@ my $mv = "mv";
my $rm = "rm";
# now check to make sure this isn't running on freefall
chomp(my $myhost = lc(`hostname`));
chomp(my $myhost = lc(hostname()));
if ($myhost ne lc($h)) {
$ssh = "$ENV{CVS_RSH} $u\@$h";
$repo = "$u\@$h:/home/ncvs";
@@ -88,6 +85,12 @@ if (!$vanilla) {
}
}
if ($dir eq "") {
warnx("Need to specify a directory with -d argument!");
usage();
exit 1;
}
my @dirs = split(/\,/, $dir);
my $portname;
foreach my $thisdir (@dirs) {