This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix POPSTACK panics that ensued from bad interaction between
[perl5.git] / makedir.SH
1 case $CONFIGDOTSH 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 # makedir.SH
20
21
22 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
23
24 case \$# in
25   0)
26     $echo "makedir pathname filenameflag"
27     exit 1
28     ;;
29 esac
30
31 : guarantee one slash before 1st component
32 case \$1 in
33   /*) ;;
34   *)  set ./\$1 \$2 ;;
35 esac
36
37 : strip last component if it is to be a filename
38 case X\$2 in
39   X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
40   *)  set \$1 ;;
41 esac
42
43 : return reasonable status if nothing to be created
44 if $test -d "\$1" ; then
45     exit 0
46 fi
47
48 list=''
49 while true ; do
50     case \$1 in
51     */*)
52         list="\$1 \$list"
53         set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
54         ;;
55     *)
56         break
57         ;;
58     esac
59 done
60
61 set \$list
62
63 for dir do
64     $mkdir \$dir >/dev/null 2>&1
65 done
66 !GROK!THIS!
67 $eunicefix makedir
68 chmod +x makedir