perl 3.0 patch #44 patch #42, continued
[p5sagit/p5-mst-13.2.git] / makedir.SH
CommitLineData
8d063cd8 1case $CONFIG in
2'')
3 if test ! -f config.sh; then
4 ln ../config.sh . || \
5 ln ../../config.sh . || \
6 ln ../../../config.sh . || \
7 (echo "Can't find config.sh."; exit 1)
8 fi
378cc40b 9 . ./config.sh
8d063cd8 10 ;;
11esac
12case "$0" in
13*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
14esac
15echo "Extracting makedir (with variable substitutions)"
16$spitshell >makedir <<!GROK!THIS!
17$startsh
a687059c 18# $Header: makedir.SH,v 3.0 89/10/18 15:20:27 lwall Locked $
8d063cd8 19#
20# $Log: makedir.SH,v $
a687059c 21# Revision 3.0 89/10/18 15:20:27 lwall
22# 3.0 baseline
8d063cd8 23#
24
25export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
26
27case \$# in
28 0)
29 $echo "makedir pathname filenameflag"
30 exit 1
31 ;;
32esac
33
34: guarantee one slash before 1st component
35case \$1 in
36 /*) ;;
37 *) set ./\$1 \$2 ;;
38esac
39
40: strip last component if it is to be a filename
41case X\$2 in
42 X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
43 *) set \$1 ;;
44esac
45
46: return reasonable status if nothing to be created
47if $test -d "\$1" ; then
48 exit 0
49fi
50
51list=''
52while true ; do
53 case \$1 in
54 */*)
55 list="\$1 \$list"
56 set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
57 ;;
58 *)
59 break
60 ;;
61 esac
62done
63
64set \$list
65
66for dir do
67 $mkdir \$dir >/dev/null 2>&1
68done
69!GROK!THIS!
70$eunicefix makedir
378cc40b 71chmod +x makedir