ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/mkinstalldirs
(Generate patch)

Comparing deliantra/server/utils/mkinstalldirs (file contents):
Revision 1.1.1.1 by root, Fri Feb 3 07:14:50 2006 UTC vs.
Revision 1.2 by root, Tue Mar 6 19:02:36 2007 UTC

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
8# Public domain. 8# Public domain.
9# 9#
10# This file is maintained in Automake, please report 10# This file is maintained in Automake, please report
11# bugs to <bug-automake@gnu.org> or send patches to 11# bugs to <bug-automake@gnu.org> or send patches to
12# <automake-patches@gnu.org>. 12# <automake-patches@gnu.org>.
13 13
14errstatus=0 14errstatus=0
15dirmode="" 15dirmode=755
16 16
17usage="\ 17usage="\
18Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 18Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
19 19
20Create each directory DIR (with mode MODE, if specified), including all 20Create each directory DIR (with mode MODE, if specified), including all
25# process command line arguments 25# process command line arguments
26while test $# -gt 0 ; do 26while 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
34 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 34 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
35 dirmode=$1 35 dirmode=$1
36 shift 36 shift
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
44 break 44 break
45 ;; 45 ;;
101 ;; 101 ;;
102esac 102esac
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
118 test "x$d" = x && continue
119
112 pathcomp="$pathcomp$d" 120 pathcomp=$pathcomp$d
113 case $pathcomp in 121 case $pathcomp in
114 -*) pathcomp=./$pathcomp ;; 122 -*) pathcomp=./$pathcomp ;;
115 esac 123 esac
116 124
117 if test ! -d "$pathcomp"; then 125 if test ! -d "$pathcomp"; then
122 if test ! -d "$pathcomp"; then 130 if test ! -d "$pathcomp"; then
123 errstatus=$lasterr 131 errstatus=$lasterr
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
131 errstatus=$lasterr 139 errstatus=$lasterr
132 fi 140 fi
133 fi 141 fi
134 fi 142 fi
135 fi 143 fi
136 144
137 pathcomp="$pathcomp/" 145 pathcomp=$pathcomp/
138 done 146 done
139done 147done
140 148
141exit $errstatus 149exit $errstatus
142 150

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines