From 7fd756d207eec4cbedb1e0f871a81548d24c892f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 24 Jul 2000 06:03:58 +0000 Subject: [PATCH] Add `mkinstalldirs'. --- builds/unix/mkinstalldirs | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 builds/unix/mkinstalldirs diff --git a/builds/unix/mkinstalldirs b/builds/unix/mkinstalldirs new file mode 100644 index 000000000..d0fd194fd --- /dev/null +++ b/builds/unix/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here