head	1.2;
access;
symbols
	DEVEL-BRANCH-1-1:1.2
	V1-0-0:1.2
	V0-9-11:1.2
	V0-9-10:1.2
	V0-9-9:1.2
	V0-9-8:1.2
	V0-9-7:1.2
	V0-9-6:1.1
	V0-9-5:1.1
	V0-9-4:1.1
	V0-9-3:1.1
	V0-9-2:1.1
	V0-9-1:1.1
	V0-9-0:1.1
	V0-4-5:1.1
	V0-4-4:1.1
	V0-4-3:1.1
	V0-4-2:1.1
	V0-4-1:1.1
	V0-4-0:1.1
	V0-3-5:1.1
	V0-3-4:1.1
	V0-3-3:1.1
	V0-3-2:1.1
	V0-3-1:1.1
	V0-3-0:1.1
	V0-2-19:1.1
	V0-2-18:1.1
	V0-2-17:1.1
	V0-2-15:1.1
	V0-2-10:1.1
	V-0-2-8:1.1
	V0-2-6:1.1
	V0-2-0:1.1
	V0-1-0:1.1;
locks; strict;
comment	@# @;


1.2
date	99.05.08.17.35.16;	author wkoch;	state Exp;
branches;
next	1.1;

1.1
date	97.11.18.14.05.56;	author wk;	state Exp;
branches;
next	;


desc
@@


1.2
log
@See ChangeLog: Sat May  8 19:28:33 CEST 1999  Werner Koch
@
text
@#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain

# $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
   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
   shift

   pathcomp=
   for d
   do
     pathcomp="$pathcomp$d"
     case "$pathcomp" in
       -* ) pathcomp=./$pathcomp ;;
     esac

     if test ! -d "$pathcomp"; then
        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

     pathcomp="$pathcomp/"
   done
done

exit $errstatus

# Local Variables:
# mode:shell-script
# sh-indentation:3
# End:
@


1.1
log
@initially checkin
@
text
@d7 1
a7 1
# $Id: mkinstalldirs,v 1.1.1.1 1997/09/18 16:53:47 sopwith Exp $
d10 20
d45 1
a45 1
        echo "mkdir $pathcomp" 1>&2
d51 11
d71 4
a74 1
# mkinstalldirs ends here
@
