X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=mkinstalldirs;h=55d537f872ccde377e96a1f34e37624a06834b26;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=6fbe5e117629c75a723710efc4b2e0341c17c895;hpb=556367927f1f92e90a2b87e7594fb4fd1fd65546;p=deliverable%2Fbinutils-gdb.git diff --git a/mkinstalldirs b/mkinstalldirs index 6fbe5e1176..55d537f872 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,7 +1,7 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -scriptversion=2004-02-15.20 +scriptversion=2009-04-28.21; # UTC # Original author: Noah Friedman # Created: 1993-05-16 @@ -11,8 +11,11 @@ scriptversion=2004-02-15.20 # bugs to or send patches to # . +nl=' +' +IFS=" "" $nl" errstatus=0 -dirmode="" +dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... @@ -27,7 +30,7 @@ while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" - exit 0 + exit $? ;; -m) # -m PERM arg shift @@ -37,7 +40,7 @@ while test $# -gt 0 ; do ;; --version) echo "$0 $scriptversion" - exit 0 + exit $? ;; --) # stop option processing shift @@ -78,9 +81,9 @@ case $dirmode in echo "mkdir -p -- $*" exec mkdir -p -- "$@" else - # On NextStep and OpenStep, the `mkdir' command does not + # On NextStep and OpenStep, the 'mkdir' command does not # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already + # directories to create, and then abort because '.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version @@ -103,13 +106,21 @@ esac for file do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + case $file in + /*) pathcomp=/ ;; + *) pathcomp= ;; + esac + oIFS=$IFS + IFS=/ + set fnord $file shift + IFS=$oIFS - pathcomp= for d do - pathcomp="$pathcomp$d" + test "x$d" = x && continue + + pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac @@ -124,7 +135,7 @@ do else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" - lasterr="" + lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then @@ -134,7 +145,7 @@ do fi fi - pathcomp="$pathcomp/" + pathcomp=$pathcomp/ done done @@ -146,5 +157,6 @@ exit $errstatus # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: