e55d2b7c6747133a3de724e134f7e1367c1dbe81
[p5sagit/p5-mst-13.2.git] / makedir.SH
1 case $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 2>/dev/null
9     . ./config.sh
10     ;;
11 esac
12 case "$0" in
13 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
14 esac
15 echo "Extracting makedir (with variable substitutions)"
16 rm -f makedir
17 $spitshell >makedir <<!GROK!THIS!
18 $startsh
19 # $RCSfile: makedir.SH,v $$Revision: 4.0.1.1 $$Date: 92/06/08 14:24:55 $
20
21 # $Log: makedir.SH,v $
22 # Revision 4.0.1.1  92/06/08  14:24:55  lwall
23 # patch20: SH files didn't work well with symbolic links
24
25 # Revision 4.0  91/03/20  01:27:13  lwall
26 # 4.0 baseline.
27
28
29
30 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
31
32 case \$# in
33   0)
34     $echo "makedir pathname filenameflag"
35     exit 1
36     ;;
37 esac
38
39 : guarantee one slash before 1st component
40 case \$1 in
41   /*) ;;
42   *)  set ./\$1 \$2 ;;
43 esac
44
45 : strip last component if it is to be a filename
46 case X\$2 in
47   X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
48   *)  set \$1 ;;
49 esac
50
51 : return reasonable status if nothing to be created
52 if $test -d "\$1" ; then
53     exit 0
54 fi
55
56 list=''
57 while true ; do
58     case \$1 in
59     */*)
60         list="\$1 \$list"
61         set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
62         ;;
63     *)
64         break
65         ;;
66     esac
67 done
68
69 set \$list
70
71 for dir do
72     $mkdir \$dir >/dev/null 2>&1
73 done
74 !GROK!THIS!
75 $eunicefix makedir
76 chmod +x makedir