annotate mkinstalldirs @ 2:7bf4a164d5bb default tip

fix bug: long_options have to be zero terminated
author Peter Meerwald <p.meerwald@bct-electronic.com>
date Fri, 20 Jul 2012 11:28:30 +0200
parents b8f7423e385c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
1 #! /bin/sh
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
2 # mkinstalldirs --- make directory hierarchy
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
3 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
4 # Created: 1993-05-16
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
5 # Public domain
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
6
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
7 # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
8
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
9 errstatus=0
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
10
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
11 for file
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
12 do
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
13 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
14 shift
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
15
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
16 pathcomp=
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
17 for d
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
18 do
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
19 pathcomp="$pathcomp$d"
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
20 case "$pathcomp" in
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
21 -* ) pathcomp=./$pathcomp ;;
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
22 esac
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
23
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
24 if test ! -d "$pathcomp"; then
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
25 echo "mkdir $pathcomp"
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
26
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
27 mkdir "$pathcomp" || lasterr=$?
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
28
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
29 if test ! -d "$pathcomp"; then
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
30 errstatus=$lasterr
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
31 fi
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
32 fi
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
33
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
34 pathcomp="$pathcomp/"
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
35 done
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
36 done
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
37
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
38 exit $errstatus
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
39
b8f7423e385c import 0.13
Peter Meerwald <pmeerw@pmeerw.net>
parents:
diff changeset
40 # mkinstalldirs ends here

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.