mkinstalldirs revision 181097
1119381Sjake#! /bin/sh
2119381Sjake# mkinstalldirs --- make directory hierarchy
3119381Sjake# Author: Noah Friedman <friedman@prep.ai.mit.edu>
4119381Sjake# Created: 1993-05-16
5119381Sjake# Public domain
6119381Sjake
7119381Sjake# $Id: mkinstalldirs,v 1.2 2003/11/21 12:48:55 djm Exp $
8119381Sjake
9119381Sjakeerrstatus=0
10119381Sjake
11119381Sjakefor file
12119381Sjakedo
13119381Sjake   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
14119381Sjake   shift
15119381Sjake
16119381Sjake   pathcomp=
17119381Sjake   for d
18119381Sjake   do
19119381Sjake     pathcomp="$pathcomp$d"
20119381Sjake     case "$pathcomp" in
21119381Sjake       -* ) pathcomp=./$pathcomp ;;
22119381Sjake     esac
23119381Sjake
24119381Sjake     if test ! -d "$pathcomp"; then
25119381Sjake	echo "mkdir $pathcomp"
26119381Sjake
27119381Sjake	mkdir "$pathcomp" || lasterr=$?
28119381Sjake
29119381Sjake	if test ! -d "$pathcomp"; then
30119381Sjake	  errstatus=$lasterr
31119381Sjake	fi
32119381Sjake     fi
33119381Sjake
34119381Sjake     pathcomp="$pathcomp/"
35119381Sjake   done
36119381Sjakedone
37119381Sjake
38119381Sjakeexit $errstatus
39119381Sjake
40119381Sjake# mkinstalldirs ends here
41119381Sjake