freebsd-dev/contrib/ntp/mkinstalldirs

41 lines
723 B
Plaintext
Raw Normal View History

2000-01-28 14:55:50 +00:00
#! /bin/sh
1999-12-09 13:01:21 +00:00
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
2001-08-29 14:35:15 +00:00
# $Id: mkinstalldirs,v 1.3 2001/04/23 03:27:24 stenn Exp $
2000-01-28 14:55:50 +00:00
1999-12-09 13:01:21 +00:00
errstatus=0
2000-01-28 14:55:50 +00:00
for file
do
1999-12-09 13:01:21 +00:00
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
2000-01-28 14:55:50 +00:00
for d
do
1999-12-09 13:01:21 +00:00
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
2000-01-28 14:55:50 +00:00
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
1999-12-09 13:01:21 +00:00
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here