annotate C-- calls that do not return
[ghc-hetmet.git] / utils / mkdirhier / mkdirhier.sh
1 #!/bin/sh
2
3 #
4 # create a hierarchy of directories
5 #
6 # Based on Noah Friedman's mkinstalldirs..
7 #
8 errs=0
9
10 for f in $*; do
11     parts=`echo ":$f" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
12     path="";
13     for p in $parts; do
14         path="$path$p"
15         case "$path" in
16           -* ) path=./$path ;;
17         esac
18
19         if test ! -d "$path"; then
20            echo "mkdir $path" 1>&2
21
22            mkdir "$path" || lasterr=$?
23            
24            if test ! -d "$path"; then
25               errs=$lasterr
26            fi 
27         fi
28         path="$path/";
29     done;
30 done
31
32 exit $errs
33
34 # end of story