xref: /netbsd-src/external/bsd/less/dist/mkinstalldirs (revision 20006a0bde522c99e03e2f0935b37976c345030a)
1*20006a0bStron#!/bin/sh
2*20006a0bStron# mkinstalldirs --- make directory hierarchy
3*20006a0bStron# Author: Noah Friedman <friedman@prep.ai.mit.edu>
4*20006a0bStron# Created: 1993-05-16
5*20006a0bStron# Last modified: 1994-03-25
6*20006a0bStron# Public domain
7*20006a0bStron
8*20006a0bStronerrstatus=0
9*20006a0bStron
10*20006a0bStronfor file in ${1+"$@"} ; do
11*20006a0bStron   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
12*20006a0bStron   shift
13*20006a0bStron
14*20006a0bStron   pathcomp=
15*20006a0bStron   for d in ${1+"$@"} ; do
16*20006a0bStron     pathcomp="$pathcomp$d"
17*20006a0bStron     case "$pathcomp" in
18*20006a0bStron       -* ) pathcomp=./$pathcomp ;;
19*20006a0bStron     esac
20*20006a0bStron
21*20006a0bStron     if test ! -d "$pathcomp"; then
22*20006a0bStron        echo "mkdir $pathcomp" 1>&2
23*20006a0bStron        mkdir "$pathcomp" || errstatus=$?
24*20006a0bStron     fi
25*20006a0bStron
26*20006a0bStron     pathcomp="$pathcomp/"
27*20006a0bStron   done
28*20006a0bStrondone
29*20006a0bStron
30*20006a0bStronexit $errstatus
31*20006a0bStron
32*20006a0bStron# mkinstalldirs ends here
33