#!/bin/sh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # gos720 src/gos/2d/XTOP/config/util/mkdirhier.sh 1.2 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 1997,2006 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # SCCSID_BEGIN_TAG # @(#)42 1.2 src/gos/2d/XTOP/config/util/mkdirhier.sh, xclients, gos720 10/5/06 07:24:31 # SCCSID_END_TAG # $XConsortium: mkdirhier.sh,v 1.7 94/03/24 15:46:34 gildea Exp $ # Courtesy of Paul Eggert newline=' ' IFS=$newline USERBIN=/usr/bin case ${1--} in -*) echo >&2 "mkdirhier: usage: mkdirhier directory ..."; exit 1 esac status= for directory do case $directory in '') echo >&2 "mkdirhier: empty directory name" status=1 continue;; *"$newline"*) echo >&2 "mkdirhier: directory name contains a newline: \`\`$directory''" status=1 continue;; ///*) prefix=/;; # See Posix 2.3 "path". //*) prefix=//;; /*) prefix=/;; -*) prefix=./;; *) prefix= esac IFS=/ set x $directory case $2 in */*) # IFS parsing is broken IFS=' ' set x `echo $directory | $USERBIN/tr / ' '` ;; esac IFS=$newline shift for filename do path=$prefix$filename prefix=$path/ shift test -d "$path" || { paths=$path for filename do if [ "$filename" != "." ]; then path=$path/$filename paths=$paths$newline$path fi done $USERBIN/mkdir $paths || status=$? break } done done exit $status