xref: /freebsd/crypto/heimdal/lib/roken/mkinstalldirs (revision 5e9cd1ae3e10592ed70e7575551cba1bbab04d84)
15e9cd1aeSAssar Westerlund#! /bin/sh
25e9cd1aeSAssar Westerlund# mkinstalldirs --- make directory hierarchy
35e9cd1aeSAssar Westerlund# Author: Noah Friedman <friedman@prep.ai.mit.edu>
45e9cd1aeSAssar Westerlund# Created: 1993-05-16
55e9cd1aeSAssar Westerlund# Public domain
65e9cd1aeSAssar Westerlund
75e9cd1aeSAssar Westerlund# $Id$
85e9cd1aeSAssar Westerlund
95e9cd1aeSAssar Westerlunderrstatus=0
105e9cd1aeSAssar Westerlund
115e9cd1aeSAssar Westerlundfor file
125e9cd1aeSAssar Westerlunddo
135e9cd1aeSAssar Westerlund   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
145e9cd1aeSAssar Westerlund   shift
155e9cd1aeSAssar Westerlund
165e9cd1aeSAssar Westerlund   pathcomp=
175e9cd1aeSAssar Westerlund   for d
185e9cd1aeSAssar Westerlund   do
195e9cd1aeSAssar Westerlund     pathcomp="$pathcomp$d"
205e9cd1aeSAssar Westerlund     case "$pathcomp" in
215e9cd1aeSAssar Westerlund       -* ) pathcomp=./$pathcomp ;;
225e9cd1aeSAssar Westerlund     esac
235e9cd1aeSAssar Westerlund
245e9cd1aeSAssar Westerlund     if test ! -d "$pathcomp"; then
255e9cd1aeSAssar Westerlund        echo "mkdir $pathcomp"
265e9cd1aeSAssar Westerlund
275e9cd1aeSAssar Westerlund        mkdir "$pathcomp" || lasterr=$?
285e9cd1aeSAssar Westerlund
295e9cd1aeSAssar Westerlund        if test ! -d "$pathcomp"; then
305e9cd1aeSAssar Westerlund  	  errstatus=$lasterr
315e9cd1aeSAssar Westerlund        fi
325e9cd1aeSAssar Westerlund     fi
335e9cd1aeSAssar Westerlund
345e9cd1aeSAssar Westerlund     pathcomp="$pathcomp/"
355e9cd1aeSAssar Westerlund   done
365e9cd1aeSAssar Westerlunddone
375e9cd1aeSAssar Westerlund
385e9cd1aeSAssar Westerlundexit $errstatus
395e9cd1aeSAssar Westerlund
405e9cd1aeSAssar Westerlund# mkinstalldirs ends here
41