Changeset 620
- Timestamp:
- Mar 9, 2007 6:17:34 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tcl/tclconfig/mkinstalldirs
r204 r620 1 1 #! /bin/sh 2 2 # mkinstalldirs --- make directory hierarchy 3 # Author: Noah Friedman <friedman@prep.ai.mit.edu> 3 4 scriptversion=2003-11-08.23 5 6 # Original author: Noah Friedman <friedman@prep.ai.mit.edu> 4 7 # Created: 1993-05-16 5 # Public domain 6 7 # $Id: mkinstalldirs,v 1.1.1.1 1999/08/04 23:03:40 wart Exp $ 8 # Public domain. 9 # 10 # This file is maintained in Automake, please report 11 # bugs to <bug-automake@gnu.org> or send patches to 12 # <automake-patches@gnu.org>. 8 13 9 14 errstatus=0 15 dirmode="" 16 17 usage="\ 18 Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 19 20 Create each directory DIR (with mode MODE, if specified), including all 21 leading file name components. 22 23 Report bugs to <bug-automake@gnu.org>." 24 25 # process command line arguments 26 while test $# -gt 0 ; do 27 case $1 in 28 -h | --help | --h*) # -h for help 29 echo "$usage" 30 exit 0 31 ;; 32 -m) # -m PERM arg 33 shift 34 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 35 dirmode=$1 36 shift 37 ;; 38 --version) 39 echo "$0 $scriptversion" 40 exit 0 41 ;; 42 --) # stop option processing 43 shift 44 break 45 ;; 46 -*) # unknown option 47 echo "$usage" 1>&2 48 exit 1 49 ;; 50 *) # first non-opt arg 51 break 52 ;; 53 esac 54 done 10 55 11 56 for file 12 57 do 13 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 shift 58 if test -d "$file"; then 59 shift 60 else 61 break 62 fi 63 done 15 64 16 pathcomp= 17 for d 18 do 19 pathcomp="$pathcomp$d" 20 case "$pathcomp" in 21 -* ) pathcomp=./$pathcomp ;; 22 esac 65 case $# in 66 0) exit 0 ;; 67 esac 23 68 24 if test ! -d "$pathcomp"; then 25 echo "mkdir $pathcomp" 69 case $dirmode in 70 '') 71 if mkdir -p -- . 2>/dev/null; then 72 echo "mkdir -p -- $*" 73 exec mkdir -p -- "$@" 74 else 75 # On NextStep and OpenStep, the `mkdir' command does not 76 # recognize any option. It will interpret all options as 77 # directories to create, and then abort because `.' already 78 # exists. 79 test -d ./-p && rmdir ./-p 80 test -d ./-- && rmdir ./-- 81 fi 82 ;; 83 *) 84 if mkdir -m "$dirmode" -p -- . 2>/dev/null; then 85 echo "mkdir -m $dirmode -p -- $*" 86 exec mkdir -m "$dirmode" -p -- "$@" 87 else 88 # Clean up after NextStep and OpenStep mkdir. 89 for d in ./-m ./-p ./-- "./$dirmode"; 90 do 91 test -d $d && rmdir $d 92 done 93 fi 94 ;; 95 esac 26 96 27 mkdir "$pathcomp" || lasterr=$? 97 for file 98 do 99 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 100 shift 28 101 29 if test ! -d "$pathcomp"; then 30 errstatus=$lasterr 31 fi 32 fi 102 pathcomp= 103 for d 104 do 105 pathcomp="$pathcomp$d" 106 case $pathcomp in 107 -*) pathcomp=./$pathcomp ;; 108 esac 33 109 34 pathcomp="$pathcomp/" 35 done 110 if test ! -d "$pathcomp"; then 111 echo "mkdir $pathcomp" 112 113 mkdir "$pathcomp" || lasterr=$? 114 115 if test ! -d "$pathcomp"; then 116 errstatus=$lasterr 117 else 118 if test ! -z "$dirmode"; then 119 echo "chmod $dirmode $pathcomp" 120 lasterr="" 121 chmod "$dirmode" "$pathcomp" || lasterr=$? 122 123 if test ! -z "$lasterr"; then 124 errstatus=$lasterr 125 fi 126 fi 127 fi 128 fi 129 130 pathcomp="$pathcomp/" 131 done 36 132 done 37 133 38 134 exit $errstatus 39 135 40 # mkinstalldirs ends here 136 # Local Variables: 137 # mode: shell-script 138 # sh-indentation: 2 139 # eval: (add-hook 'write-file-hooks 'time-stamp) 140 # time-stamp-start: "scriptversion=" 141 # time-stamp-format: "%:y-%02m-%02d.%02H" 142 # time-stamp-end: "$" 143 # End:
Note: See TracChangeset
for help on using the changeset viewer.