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

Alan Coopersmith alan.coopersmith at oracle.com
Tue May 4 16:05:25 PDT 2010


Since I'd suggested it, I was hoping someone else would review it too, but
since I haven't seen anyone else...

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

	-alan-

Yaakov (Cygwin/X) wrote:
> 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


-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list