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