1#! /bin/sh
2# $Id: mkdirs.sh,v 1.5 2007/03/25 22:29:46 tom Exp $
3# -----------------------------------------------------------------------------
4# mkinstalldirs --- make directory hierarchy
5# Author: Noah Friedman <friedman@prep.ai.mit.edu>
6# Created: 1993-05-16
7# Last modified: 1994-03-25
8# Public domain
9# -----------------------------------------------------------------------------
10
11errstatus=0
12umask 022
13
14for file in ${1+"$@"} ; do
15   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
16   shift
17
18   pathcomp=
19   for d in ${1+"$@"} ; do
20     pathcomp="$pathcomp$d"
21     case "$pathcomp" in
22       -* ) pathcomp=./$pathcomp ;;
23     esac
24
25     if test ! -d "$pathcomp"; then
26        echo "mkdir $pathcomp" 1>&2
27        case "$pathcomp" in
28          [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]: )
29            ;;               # DOSISH systems
30          * )
31            mkdir "$pathcomp"
32            errstatus=$?
33            if test $errstatus != 0
34            then
35               # may have failed if invoked in a parallel "make -j# install"
36               if test -d "$pathcomp"
37               then
38                  errstatus=0
39               fi
40            fi
41            ;;
42        esac
43     fi
44
45     pathcomp="$pathcomp/"
46   done
47done
48
49exit $errstatus
50
51# mkinstalldirs ends here
52