xref: /netbsd-src/external/bsd/libbind/dist/mkinstalldirs (revision 5bbd2a12505d72a8177929a37b5cee489d0a1cfd)
1*b5677b36Schristos#! /bin/sh
2*b5677b36Schristos# mkinstalldirs --- make directory hierarchy
3*b5677b36Schristos# Author: Noah Friedman <friedman@prep.ai.mit.edu>
4*b5677b36Schristos# Created: 1993-05-16
5*b5677b36Schristos# Public domain
6*b5677b36Schristos
7*b5677b36Schristos# Id: mkinstalldirs,v 1.1 2001/07/06 22:23:42 gson Exp
8*b5677b36Schristos
9*b5677b36Schristoserrstatus=0
10*b5677b36Schristos
11*b5677b36Schristosfor file
12*b5677b36Schristosdo
13*b5677b36Schristos   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
14*b5677b36Schristos   shift
15*b5677b36Schristos
16*b5677b36Schristos   pathcomp=
17*b5677b36Schristos   for d
18*b5677b36Schristos   do
19*b5677b36Schristos     pathcomp="$pathcomp$d"
20*b5677b36Schristos     case "$pathcomp" in
21*b5677b36Schristos       -* ) pathcomp=./$pathcomp ;;
22*b5677b36Schristos     esac
23*b5677b36Schristos
24*b5677b36Schristos     if test ! -d "$pathcomp"; then
25*b5677b36Schristos        echo "mkdir $pathcomp" 1>&2
26*b5677b36Schristos
27*b5677b36Schristos        mkdir "$pathcomp" || lasterr=$?
28*b5677b36Schristos
29*b5677b36Schristos        if test ! -d "$pathcomp"; then
30*b5677b36Schristos  	  errstatus=$lasterr
31*b5677b36Schristos        fi
32*b5677b36Schristos     fi
33*b5677b36Schristos
34*b5677b36Schristos     pathcomp="$pathcomp/"
35*b5677b36Schristos   done
36*b5677b36Schristosdone
37*b5677b36Schristos
38*b5677b36Schristosexit $errstatus
39*b5677b36Schristos
40*b5677b36Schristos# mkinstalldirs ends here
41