[PATCH imake 4/4] mkdirhier: use mkdir -p

Yaakov (Cygwin/X) yselkowitz at users.sourceforge.net
Tue Apr 27 18:44:38 PDT 2010


From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

The '-p' option to mkdir(1) is required by SUSv2/Unix98, so we should be
able to rely on it on all systems we support.  Some parts need to be
left in place in order to not alter some of its ancient, shall we say,
quirks.

Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
---
 mkdirhier |   35 +----------------------------------
 1 files changed, 1 insertions(+), 34 deletions(-)

diff --git a/mkdirhier b/mkdirhier
index f275b90..0efd4c7 100644
--- a/mkdirhier
+++ b/mkdirhier
@@ -22,45 +22,12 @@ do
 		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 | tr / ' '`
-		;;
-	esac
-	IFS=$newline
-	shift
-
-	for filename
-	do
-		path=$prefix$filename
-		prefix=$path/
-		shift
-
-		test -d "$path" || {
-			paths=$path
-			for filename
-			do
-				if [ -n "$filename" -a "$filename" != "." ]; then
-					path=$path/$filename
-					paths=$paths$newline$path
-				fi
-			done
-
-			mkdir $paths || status=$?
+	mkdir -p $prefix$directory || status=$?
 
-			break
-		}
-	done
   done
 
 exit $status
-- 
1.7.0.4



More information about the xorg-devel mailing list