| 1 | #! /bin/sh |
| 2 | # mkinstalldirs --- make directory hierarchy |
| 3 | # Author: Noah Friedman <friedman@prep.ai.mit.edu> |
| 4 | # Created: 1993-05-16 |
| 5 | # Public domain |
| 6 | |
| 7 | |
| 8 | errstatus=0 |
| 9 | |
| 10 | for file |
| 11 | do |
| 12 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` |
| 13 | shift |
| 14 | |
| 15 | pathcomp= |
| 16 | for d |
| 17 | do |
| 18 | pathcomp="$pathcomp$d" |
| 19 | case "$pathcomp" in |
| 20 | -* ) pathcomp=./$pathcomp ;; |
| 21 | esac |
| 22 | |
| 23 | if test ! -d "$pathcomp"; then |
| 24 | echo "mkdir $pathcomp" 1>&2 |
| 25 | |
| 26 | mkdir "$pathcomp" || lasterr=$? |
| 27 | |
| 28 | if test ! -d "$pathcomp"; then |
| 29 | errstatus=$lasterr |
| 30 | fi |
| 31 | fi |
| 32 | |
| 33 | pathcomp="$pathcomp/" |
| 34 | done |
| 35 | done |
| 36 | |
| 37 | exit $errstatus |
| 38 | |
| 39 | # mkinstalldirs ends here |
| 40 | |