1#!/bin/sh
2########################################################################
3#                                                                      #
4#               This software is part of the ast package               #
5#          Copyright (c) 1994-2011 AT&T Intellectual Property          #
6#                      and is licensed under the                       #
7#                 Eclipse Public License, Version 1.0                  #
8#                    by AT&T Intellectual Property                     #
9#                                                                      #
10#                A copy of the License is available at                 #
11#          http://www.eclipse.org/org/documents/epl-v10.html           #
12#         (with md5 checksum b35adb5213ca9657e911e9befb180842)         #
13#                                                                      #
14#              Information and Software Systems Research               #
15#                            AT&T Research                             #
16#                           Florham Park NJ                            #
17#                                                                      #
18#                 Glenn Fowler <gsf@research.att.com>                  #
19#                                                                      #
20########################################################################
21: mkdir for systems that do not support -p : 2002-09-01 :
22MKDIR=/bin/mkdir
23CHMOD=chmod
24mode=
25parents=
26while	:
27do	case $1 in
28	-m)	case $# in
29		1)	echo "mkdir: -m: mode argument expected" >&2
30			exit 1
31			;;
32		esac
33		shift
34		mode=$1
35		;;
36	-m*)	mode=`echo X$1 | sed 's/X-m//'`
37		;;
38	-p)	parents=1
39		;;
40	*)	break
41		;;
42	esac
43	shift
44done
45if	test "" != "$parents"
46then	for d
47	do	if	test ! -d $d
48		then	ifs=${IFS-'
49	 '}
50			IFS=/
51			set '' $d
52			IFS=$ifs
53			shift
54			dir=$1
55			shift
56			if	test -n "$dir" -a ! -d "$dir"
57			then	$MKDIR "$dir" || exit 1
58				if	test "" != "$mode"
59				then	$CHMOD "$mode" "$dir" || exit 1
60				fi
61			fi
62			for d
63			do	dir=$dir/$d
64				if	test ! -d "$dir"
65				then	$MKDIR "$dir" || exit 1
66					if	test "" != "$mode"
67					then	$CHMOD "$mode" "$dir" || exit 1
68					fi
69				fi
70			done
71		fi
72	done
73else	$MKDIR "$@" || exit 1
74	if	test "" != "$mode"
75	then	for d
76		do	$CHMOD "$mode" "$d" || exit 1
77		done
78	fi
79fi
80exit 0
81