diff options
Diffstat (limited to 'contrib/bison/mkinstalldirs')
-rwxr-xr-x | contrib/bison/mkinstalldirs | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/contrib/bison/mkinstalldirs b/contrib/bison/mkinstalldirs index a01481be4367..b7f218d27d28 100755 --- a/contrib/bison/mkinstalldirs +++ b/contrib/bison/mkinstalldirs @@ -4,9 +4,29 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.10 1996/05/03 07:37:52 friedman Exp $ +# $Id: mkinstalldirs,v 1.2 1999/04/11 00:23:56 bje Exp $ errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done for file do @@ -22,12 +42,23 @@ do esac if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 + echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + + lasterr="" + chmod $dirmode "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi fi fi @@ -37,4 +68,7 @@ done exit $errstatus -# mkinstalldirs ends here +# Local Variables: +# mode:shell-script +# sh-indentation:3 +# End: |