215661a6eea33a26d03155d304b210ec76e235e5
[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
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 $spitshell >makedir <<!GROK!THIS!
17 $startsh
18 # $Header: makedir.SH,v 2.0 88/06/05 00:09:13 root Exp $
19
20 # $Log: makedir.SH,v $
21 # Revision 2.0  88/06/05  00:09:13  root
22 # Baseline version 2.0.
23
24
25
26 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
27
28 case \$# in
29   0)
30     $echo "makedir pathname filenameflag"
31     exit 1
32     ;;
33 esac
34
35 : guarantee one slash before 1st component
36 case \$1 in
37   /*) ;;
38   *)  set ./\$1 \$2 ;;
39 esac
40
41 : strip last component if it is to be a filename
42 case X\$2 in
43   X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
44   *)  set \$1 ;;
45 esac
46
47 : return reasonable status if nothing to be created
48 if $test -d "\$1" ; then
49     exit 0
50 fi
51
52 list=''
53 while true ; do
54     case \$1 in
55     */*)
56         list="\$1 \$list"
57         set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
58         ;;
59     *)
60         break
61         ;;
62     esac
63 done
64
65 set \$list
66
67 for dir do
68     $mkdir \$dir >/dev/null 2>&1
69 done
70 !GROK!THIS!
71 $eunicefix makedir
72 chmod +x makedir