aboutsummaryrefslogtreecommitdiff
path: root/mkinstalldirs
diff options
context:
space:
mode:
Diffstat (limited to 'mkinstalldirs')
-rw-r--r--mkinstalldirs26
1 files changed, 17 insertions, 9 deletions
diff --git a/mkinstalldirs b/mkinstalldirs
index 6fbe5e11..259dbfcd 100644
--- a/mkinstalldirs
+++ b/mkinstalldirs
@@ -1,7 +1,7 @@
1#! /bin/sh 1#! /bin/sh
2# mkinstalldirs --- make directory hierarchy 2# mkinstalldirs --- make directory hierarchy
3 3
4scriptversion=2004-02-15.20 4scriptversion=2005-06-29.22
5 5
6# Original author: Noah Friedman <friedman@prep.ai.mit.edu> 6# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
7# Created: 1993-05-16 7# Created: 1993-05-16
@@ -12,7 +12,7 @@ scriptversion=2004-02-15.20
12# <automake-patches@gnu.org>. 12# <automake-patches@gnu.org>.
13 13
14errstatus=0 14errstatus=0
15dirmode="" 15dirmode=
16 16
17usage="\ 17usage="\
18Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 18Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
@@ -27,7 +27,7 @@ while test $# -gt 0 ; do
27 case $1 in 27 case $1 in
28 -h | --help | --h*) # -h for help 28 -h | --help | --h*) # -h for help
29 echo "$usage" 29 echo "$usage"
30 exit 0 30 exit $?
31 ;; 31 ;;
32 -m) # -m PERM arg 32 -m) # -m PERM arg
33 shift 33 shift
@@ -37,7 +37,7 @@ while test $# -gt 0 ; do
37 ;; 37 ;;
38 --version) 38 --version)
39 echo "$0 $scriptversion" 39 echo "$0 $scriptversion"
40 exit 0 40 exit $?
41 ;; 41 ;;
42 --) # stop option processing 42 --) # stop option processing
43 shift 43 shift
@@ -103,13 +103,21 @@ esac
103 103
104for file 104for file
105do 105do
106 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 106 case $file in
107 /*) pathcomp=/ ;;
108 *) pathcomp= ;;
109 esac
110 oIFS=$IFS
111 IFS=/
112 set fnord $file
107 shift 113 shift
114 IFS=$oIFS
108 115
109 pathcomp=
110 for d 116 for d
111 do 117 do
112 pathcomp="$pathcomp$d" 118 test "x$d" = x && continue
119
120 pathcomp=$pathcomp$d
113 case $pathcomp in 121 case $pathcomp in
114 -*) pathcomp=./$pathcomp ;; 122 -*) pathcomp=./$pathcomp ;;
115 esac 123 esac
@@ -124,7 +132,7 @@ do
124 else 132 else
125 if test ! -z "$dirmode"; then 133 if test ! -z "$dirmode"; then
126 echo "chmod $dirmode $pathcomp" 134 echo "chmod $dirmode $pathcomp"
127 lasterr="" 135 lasterr=
128 chmod "$dirmode" "$pathcomp" || lasterr=$? 136 chmod "$dirmode" "$pathcomp" || lasterr=$?
129 137
130 if test ! -z "$lasterr"; then 138 if test ! -z "$lasterr"; then
@@ -134,7 +142,7 @@ do
134 fi 142 fi
135 fi 143 fi
136 144
137 pathcomp="$pathcomp/" 145 pathcomp=$pathcomp/
138 done 146 done
139done 147done
140 148