scriptversion=2006-05-11.19

nl='
'
IFS=" ""	${nl}"
errstatus=0
# default directory mode for all zsh files is world read- and executable
dirmode=755

usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...

Create each directory DIR (with mode MODE, if specified), including all
leading file name components."

# process command line arguments
while test "$#" -gt 0; do
  case "$1" in
    -h | --help | --h*) # -h for help
      echo "${usage}"
      exit 0
      ;;
    -m) # -m PERM arg
      shift
      test "$#" -eq 0 && {
        echo "${usage}" 1>&2
        exit 1
      }
      # shellcheck disable=SC2034
      dirmode="$1"
      shift
      ;;
    --version)
      echo "$0 ${scriptversion}"
      exit 0
      ;;
    --) # stop option processing
      shift
      break
      ;;
    -*) # unknown option
      echo "${usage}" 1>&2
      exit 1
      ;;
    *) # first non-opt arg
      break
      ;;
  esac
done

exit "${errstatus}"
