xref: /aosp_15_r20/external/mtools/mkinstalldirs (revision d5c9a868b113e0ec0db2f27bc2ce8a253e77c4b0)
1*d5c9a868SElliott Hughes#! /bin/sh
2*d5c9a868SElliott Hughes
3*d5c9a868SElliott Hughes# Copyright 1993 Noah Friedman <[email protected]>
4*d5c9a868SElliott Hughes# Copyright 1996,1997,2001,2002 Alain Knaff.
5*d5c9a868SElliott Hughes# This file is part of mtools.
6*d5c9a868SElliott Hughes#
7*d5c9a868SElliott Hughes# Mtools is free software: you can redistribute it and/or modify
8*d5c9a868SElliott Hughes# it under the terms of the GNU General Public License as published by
9*d5c9a868SElliott Hughes# the Free Software Foundation, either version 3 of the License, or
10*d5c9a868SElliott Hughes# (at your option) any later version.
11*d5c9a868SElliott Hughes#
12*d5c9a868SElliott Hughes# Mtools is distributed in the hope that it will be useful,
13*d5c9a868SElliott Hughes# but WITHOUT ANY WARRANTY; without even the implied warranty of
14*d5c9a868SElliott Hughes# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*d5c9a868SElliott Hughes# GNU General Public License for more details.
16*d5c9a868SElliott Hughes#
17*d5c9a868SElliott Hughes# You should have received a copy of the GNU General Public License
18*d5c9a868SElliott Hughes# along with Mtools.  If not, see <http://www.gnu.org/licenses/>.
19*d5c9a868SElliott Hughes
20*d5c9a868SElliott Hughes# mkinstalldirs --- make directory hierarchy
21*d5c9a868SElliott Hughes# Author: Noah Friedman <[email protected]>
22*d5c9a868SElliott Hughes# Created: 1993-05-16
23*d5c9a868SElliott Hughes# Last modified: 1994-03-25
24*d5c9a868SElliott Hughes# Public domain
25*d5c9a868SElliott Hughes
26*d5c9a868SElliott Hugheserrstatus=0
27*d5c9a868SElliott Hughes
28*d5c9a868SElliott Hughesfor file in ${1+"$@"} ; do
29*d5c9a868SElliott Hughes   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
30*d5c9a868SElliott Hughes   shift
31*d5c9a868SElliott Hughes
32*d5c9a868SElliott Hughes   pathcomp=
33*d5c9a868SElliott Hughes   for d in ${1+"$@"} ; do
34*d5c9a868SElliott Hughes     pathcomp="$pathcomp$d"
35*d5c9a868SElliott Hughes     case "$pathcomp" in
36*d5c9a868SElliott Hughes       -* ) pathcomp=./$pathcomp ;;
37*d5c9a868SElliott Hughes     esac
38*d5c9a868SElliott Hughes
39*d5c9a868SElliott Hughes     if test ! -d "$pathcomp"; then
40*d5c9a868SElliott Hughes        echo "mkdir $pathcomp" 1>&2
41*d5c9a868SElliott Hughes        mkdir -p "$pathcomp" || errstatus=$?
42*d5c9a868SElliott Hughes     fi
43*d5c9a868SElliott Hughes
44*d5c9a868SElliott Hughes     pathcomp="$pathcomp/"
45*d5c9a868SElliott Hughes   done
46*d5c9a868SElliott Hughesdone
47*d5c9a868SElliott Hughes
48*d5c9a868SElliott Hughesexit $errstatus
49*d5c9a868SElliott Hughes
50*d5c9a868SElliott Hughes# mkinstalldirs ends here
51