bug 819106 - update processStsHeader call in hsts preload list script r=bsmith DONTBU...
[gecko.git] / nsprpub / build / cygwin-wrapper
blob3302df8bac0026f94904c666c891941dda22d220
1 #!/bin/sh
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # Stupid wrapper to avoid win32 dospath/cygdrive issues
8 # Try not to spawn programs from within this file. If the stuff in here looks royally
9 # confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643
10 # and look at the older versions of this file that are easier to read, but
11 # do basically the same thing
14 prog=$1
15 shift
16 if test -z "$prog"; then
17 exit 0
20 # If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p
21 mountpoint=$CYGDRIVE_MOUNT
22 if test -z "$mountpoint"; then
23 mountpoint=`mount -p`
24 if test -z "$mountpoint"; then
25 print "Cannot determine cygwin mount points. Exiting"
26 exit 1
30 # Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p`
31 mountpoint=${mountpoint#*/}
32 mountpoint=/${mountpoint%%[!A-Za-z0-9_]*}
33 mountpoint=${mountpoint%/}
35 args=""
36 up=""
37 if test "${prog}" = "-up"; then
38 up=1
39 prog=${1}
40 shift
43 process=1
45 # Convert the mountpoint in parameters to Win32 filenames
46 # For instance: /cygdrive/c/foo -> c:/foo
47 for i in "${@}"
49 if test "${i}" = "-wrap"; then
50 process=1
51 else
52 if test "${i}" = "-nowrap"; then
53 process=
54 else
55 if test -n "${process}"; then
56 if test -n "${up}"; then
57 pathname=${i#-I[a-zA-Z]:/}
58 if ! test "${pathname}" = "${i}"; then
59 no_i=${i#-I}
60 driveletter=${no_i%%:*}
61 i=-I${mountpoint}/${driveletter}/${pathname}
63 else
64 eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
65 if ! test "${leader}" = "${i}"; then
66 eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
67 eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
68 driveletter=${no_mountpoint%%/*}
69 i=${leader}${driveletter}:/${pathname}
74 args="${args} ${i}"
77 done
79 exec $prog $args