toolkit/crashreporter/google-breakpad/src/third_party/glog/mkinstalldirs

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/crashreporter/google-breakpad/src/third_party/glog/mkinstalldirs	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,161 @@
     1.4 +#! /bin/sh
     1.5 +# mkinstalldirs --- make directory hierarchy
     1.6 +
     1.7 +scriptversion=2006-05-11.19
     1.8 +
     1.9 +# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
    1.10 +# Created: 1993-05-16
    1.11 +# Public domain.
    1.12 +#
    1.13 +# This file is maintained in Automake, please report
    1.14 +# bugs to <bug-automake@gnu.org> or send patches to
    1.15 +# <automake-patches@gnu.org>.
    1.16 +
    1.17 +nl='
    1.18 +'
    1.19 +IFS=" ""	$nl"
    1.20 +errstatus=0
    1.21 +dirmode=
    1.22 +
    1.23 +usage="\
    1.24 +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
    1.25 +
    1.26 +Create each directory DIR (with mode MODE, if specified), including all
    1.27 +leading file name components.
    1.28 +
    1.29 +Report bugs to <bug-automake@gnu.org>."
    1.30 +
    1.31 +# process command line arguments
    1.32 +while test $# -gt 0 ; do
    1.33 +  case $1 in
    1.34 +    -h | --help | --h*)         # -h for help
    1.35 +      echo "$usage"
    1.36 +      exit $?
    1.37 +      ;;
    1.38 +    -m)                         # -m PERM arg
    1.39 +      shift
    1.40 +      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
    1.41 +      dirmode=$1
    1.42 +      shift
    1.43 +      ;;
    1.44 +    --version)
    1.45 +      echo "$0 $scriptversion"
    1.46 +      exit $?
    1.47 +      ;;
    1.48 +    --)                         # stop option processing
    1.49 +      shift
    1.50 +      break
    1.51 +      ;;
    1.52 +    -*)                         # unknown option
    1.53 +      echo "$usage" 1>&2
    1.54 +      exit 1
    1.55 +      ;;
    1.56 +    *)                          # first non-opt arg
    1.57 +      break
    1.58 +      ;;
    1.59 +  esac
    1.60 +done
    1.61 +
    1.62 +for file
    1.63 +do
    1.64 +  if test -d "$file"; then
    1.65 +    shift
    1.66 +  else
    1.67 +    break
    1.68 +  fi
    1.69 +done
    1.70 +
    1.71 +case $# in
    1.72 +  0) exit 0 ;;
    1.73 +esac
    1.74 +
    1.75 +# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
    1.76 +# mkdir -p a/c at the same time, both will detect that a is missing,
    1.77 +# one will create a, then the other will try to create a and die with
    1.78 +# a "File exists" error.  This is a problem when calling mkinstalldirs
    1.79 +# from a parallel make.  We use --version in the probe to restrict
    1.80 +# ourselves to GNU mkdir, which is thread-safe.
    1.81 +case $dirmode in
    1.82 +  '')
    1.83 +    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
    1.84 +      echo "mkdir -p -- $*"
    1.85 +      exec mkdir -p -- "$@"
    1.86 +    else
    1.87 +      # On NextStep and OpenStep, the `mkdir' command does not
    1.88 +      # recognize any option.  It will interpret all options as
    1.89 +      # directories to create, and then abort because `.' already
    1.90 +      # exists.
    1.91 +      test -d ./-p && rmdir ./-p
    1.92 +      test -d ./--version && rmdir ./--version
    1.93 +    fi
    1.94 +    ;;
    1.95 +  *)
    1.96 +    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
    1.97 +       test ! -d ./--version; then
    1.98 +      echo "mkdir -m $dirmode -p -- $*"
    1.99 +      exec mkdir -m "$dirmode" -p -- "$@"
   1.100 +    else
   1.101 +      # Clean up after NextStep and OpenStep mkdir.
   1.102 +      for d in ./-m ./-p ./--version "./$dirmode";
   1.103 +      do
   1.104 +        test -d $d && rmdir $d
   1.105 +      done
   1.106 +    fi
   1.107 +    ;;
   1.108 +esac
   1.109 +
   1.110 +for file
   1.111 +do
   1.112 +  case $file in
   1.113 +    /*) pathcomp=/ ;;
   1.114 +    *)  pathcomp= ;;
   1.115 +  esac
   1.116 +  oIFS=$IFS
   1.117 +  IFS=/
   1.118 +  set fnord $file
   1.119 +  shift
   1.120 +  IFS=$oIFS
   1.121 +
   1.122 +  for d
   1.123 +  do
   1.124 +    test "x$d" = x && continue
   1.125 +
   1.126 +    pathcomp=$pathcomp$d
   1.127 +    case $pathcomp in
   1.128 +      -*) pathcomp=./$pathcomp ;;
   1.129 +    esac
   1.130 +
   1.131 +    if test ! -d "$pathcomp"; then
   1.132 +      echo "mkdir $pathcomp"
   1.133 +
   1.134 +      mkdir "$pathcomp" || lasterr=$?
   1.135 +
   1.136 +      if test ! -d "$pathcomp"; then
   1.137 +	errstatus=$lasterr
   1.138 +      else
   1.139 +	if test ! -z "$dirmode"; then
   1.140 +	  echo "chmod $dirmode $pathcomp"
   1.141 +	  lasterr=
   1.142 +	  chmod "$dirmode" "$pathcomp" || lasterr=$?
   1.143 +
   1.144 +	  if test ! -z "$lasterr"; then
   1.145 +	    errstatus=$lasterr
   1.146 +	  fi
   1.147 +	fi
   1.148 +      fi
   1.149 +    fi
   1.150 +
   1.151 +    pathcomp=$pathcomp/
   1.152 +  done
   1.153 +done
   1.154 +
   1.155 +exit $errstatus
   1.156 +
   1.157 +# Local Variables:
   1.158 +# mode: shell-script
   1.159 +# sh-indentation: 2
   1.160 +# eval: (add-hook 'write-file-hooks 'time-stamp)
   1.161 +# time-stamp-start: "scriptversion="
   1.162 +# time-stamp-format: "%:y-%02m-%02d.%02H"
   1.163 +# time-stamp-end: "$"
   1.164 +# End:

mercurial