summaryrefslogtreecommitdiff
path: root/U/Extract.U
blob: 606aaa3e684fe4a49947799f04e5bfaccfe49269 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
?RCS: $Id: Extract.U,v 3.0.1.1 1994/10/29 15:51:46 ram Exp $
?RCS:
?RCS: Copyright (c) 1991-1993, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic Licence,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 3.0.
?RCS:
?RCS: This private version for perl5 will also extract files from
?RCS: extension MANIFEST.  (ext/Blah/MANIFEST).
?RCS:
?RCS: $Log: Extract.U,v $
?RCS: Revision 3.0.1.1  1994/10/29  15:51:46  ram
?RCS: patch36: added ?F: line for metalint file checking
?RCS:
?RCS: Revision 3.0  1993/08/18  12:04:52  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?X: 
?X: This unit produces a shell script which can be doted in order to extract
?X: .SH files with variable substitutions.
?X: 
?MAKE:Extract: Nothing
?MAKE:	-pick add $@ %<
?F:./extract !config_h.SH
?T:CONFIG dir file shlist xxx
: script used to extract .SH files with variable substitutions
cat >extract <<'EOS'
CONFIG=true
echo "Doing variable substitutions on .SH files..."
if test -f MANIFEST; then
	shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
	: Pick up possible extension manifests.
	for dir in ext/* ; do
		if test -f $dir/MANIFEST; then
			xxx=`awk '{print $1}' < $dir/MANIFEST | 
				sed -n "/\.SH$/ s@^@$dir/@p"`
			shlist="$shlist $xxx"
		fi
	done
	set x $shlist
else
	echo "(Looking for .SH files under the current directory.)"
	set x `find . -name "*.SH" -print`
fi
shift
case $# in
0) set x *.SH; shift;;
esac
if test ! -f $1; then
	shift
fi
for file in $*; do
	case "$file" in
	*/*)
		dir=`expr X$file : 'X\(.*\)/'`
		file=`expr X$file : 'X.*/\(.*\)'`
		(cd $dir && . ./$file)
		;;
	*)
		. ./$file
		;;
	esac
done
if test -f config_h.SH; then
	if test ! -f config.h; then
	: oops, they left it out of MANIFEST, probably, so do it anyway.
	. ./config_h.SH
	fi
fi
EOS