#! /bin/sh
# ----------------------------------------------------------------------------
# - aleph-mkdir                                                              -
# - create directory hierarchy                                               -
# ----------------------------------------------------------------------------
# - This program is  free software;  you can  redistribute it and/or  modify -
# - it provided that this copyright notice is kept intact.                   -
# -                                                                          -
# - This  program  is  distributed in the hope  that it  will be useful, but -
# - without  any   warranty;  without  even   the   implied    warranty   of -
# - merchantability  or fitness for a particular purpose. In not event shall -
# - the copyright holder be  liable for  any direct, indirect, incidental or -
# - special damages arising in any way out of the use of this software.      -
# ----------------------------------------------------------------------------
# - copyright (c) 1999-2003 amaury darsch                                    -
# ----------------------------------------------------------------------------

# get the directory list (thanks to mkinstalldirs)
dlist=`echo ":$1" | sed -e 's/^:\//#/;s/^://;s/\// /g;s/^#/\//'`
dpath=

# loop in the list of directory
for d in $dlist; do
    # start to concanate again
    dpath=${dpath}${d}
    # create the directory if any
    if test ! -d "$dpath"; then
        mkdir $dpath  > /dev/null 2>&1 || status=$?
    fi
    # add path and check again
    dpath=${dpath}/
    if test ! -d "$dpath"; then
        exit $status
    fi
done
