mkinstalldirs revision 922e6a3c2ac4ef900dd9dc99f0cc137f18372583
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson#! /bin/sh
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson# mkinstalldirs --- make directory hierarchy
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson# Author: Noah Friedman <friedman@prep.ai.mit.edu>
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson# Created: 1993-05-16
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson# Public domain
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson# $Id: mkinstalldirs,v 1.1 2000/09/20 19:05:51 gson Exp $
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafssonerrstatus=0
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafssonfor file
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafssondo
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson shift
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson pathcomp=
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson for d
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson do
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson pathcomp="$pathcomp$d"
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson case "$pathcomp" in
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson -* ) pathcomp=./$pathcomp ;;
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson esac
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson if test ! -d "$pathcomp"; then
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson echo "mkdir $pathcomp" 1>&2
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson mkdir "$pathcomp" || lasterr=$?
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson if test ! -d "$pathcomp"; then
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson errstatus=$lasterr
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson fi
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson fi
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson pathcomp="$pathcomp/"
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson done
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafssondone
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafssonexit $errstatus
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson# mkinstalldirs ends here