1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
;# $Id: rcsargs.pl,v 3.0 1993/08/18 12:11:01 ram Exp $
;#
;# Copyright (c) 1991-1993, Raphael Manfredi
;#
;# You may redistribute only under the terms of the Artistic Licence,
;# as specified in the README file that comes with the distribution.
;# You may reuse parts of this distribution only within the terms of
;# that same Artistic Licence; a copy of which may be found at the root
;# of the source tree for dist 3.0.
;#
;# $Log: rcsargs.pl,v $
;# Revision 3.0 1993/08/18 12:11:01 ram
;# Baseline for dist 3.0 netwide release.
;#
;#
sub rcsargs {
local($result) = '';
local($_);
while ($_ = shift(@_)) {
if ($_ =~ /^-/) {
$result .= $_ . ' ';
} elsif ($#_ >= 0 && do equiv($_,$_[0])) {
$result .= $_ . ' ' . $_[0] . ' ';
shift(@_);
} else {
$result .= $_ . ' ' . do other($_) . ' ';
}
}
$result;
}
sub equiv {
local($s1, $s2) = @_;
$s1 =~ s|.*/||;
$s2 =~ s|.*/||;
if ($s1 eq $s2) {
0;
} elsif ($s1 =~ s/$RCSEXT$// || $s2 =~ s/$RCSEXT$//) {
$s1 eq $s2;
} else {
0;
}
}
sub other {
local($s1) = @_;
($dir,$file) = ('./',$s1) unless local($dir,$file) = ($s1 =~ m|(.*/)(.*)|);
$dir = $TOPDIR . $dir if -d $TOPDIR . "$dir/RCS";
local($wasrcs) = ($file =~ s/$RCSEXT$//);
if ($wasrcs) {
`mkdir $dir` unless -d $dir;
$dir =~ s|RCS/||;
} else {
$dir .= 'RCS/';
`mkdir $dir` unless -d $dir;
$file .= $RCSEXT;
}
"$dir$file";
}
|