#!/bin/sh

# This is a helper script used in the complicated startup case where an xterm
# is being used and xterm is set up to be setuid/setgid (which it is on some
# Linux distributions).  It propagates all LD_* environment variables into
# the debug process (these are normally stripped by setuid xterm for
# general security reasons).

# Read the envs into process (Darwin does not like :'s in paths)
HOSTPORT=`echo $3 | sed y/:/-/`
LD_VARS_FILE=${HOME}/.wingide4/spawn-ld-vars-$HOSTPORT
if [ -f "$LD_VARS_FILE" ]; then
    # Use . rather than source because stripped down shells don't support source
    . "${LD_VARS_FILE}"
    rm -f  ${LD_VARS_FILE}
fi    

exec "$@"