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