Fixed Qt scrollbars rendering
[mozilla-central.git] / build / cygwin-wrapper
blob679f0a11005b88168a1815703a1aa4c04ac83778
1 #!/bin/sh
3 # Stupid wrapper to avoid win32 dospath/cygdrive issues
4 # Try not to spawn programs from within this file. If the stuff in here looks royally
5 # confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643
6 # and look at the older versions of this file that are easier to read, but
7 # do basically the same thing
10 prog=$1
11 shift
12 if test -z "$prog"; then
13 exit 0
16 # If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p
17 mountpoint=$CYGDRIVE_MOUNT
18 if test -z "$mountpoint"; then
19 mountpoint=`mount -p`
20 if test -z "$mountpoint"; then
21 print "Cannot determine cygwin mount points. Exiting"
22 exit 1
26 # Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p`
27 mountpoint=${mountpoint#*/}
28 mountpoint=/${mountpoint%%[!A-Za-z0-9_]*}
29 mountpoint=${mountpoint%/}
31 args=""
32 up=""
33 if test "${prog}" = "-up"; then
34 up=1
35 prog=${1}
36 shift
39 process=1
41 # Convert the mountpoint in parameters to Win32 filenames
42 # For instance: /cygdrive/c/foo -> c:/foo
43 for i in "${@}"
45 if test "${i}" = "-wrap"; then
46 process=1
47 else
48 if test "${i}" = "-nowrap"; then
49 process=
50 else
51 if test -n "${process}"; then
52 if test -n "${up}"; then
53 pathname=${i#-I[a-zA-Z]:/}
54 if ! test "${pathname}" = "${i}"; then
55 no_i=${i#-I}
56 driveletter=${no_i%%:*}
57 i=-I${mountpoint}/${driveletter}/${pathname}
59 else
60 eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
61 if ! test "${leader}" = "${i}"; then
62 eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
63 eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
64 driveletter=${no_mountpoint%%/*}
65 i=${leader}${driveletter}:/${pathname}
70 args="${args} ${i}"
73 done
75 exec $prog $args