diff options
Diffstat (limited to 'startx.cpp')
-rw-r--r-- | startx.cpp | 89 |
1 files changed, 61 insertions, 28 deletions
@@ -1,4 +1,4 @@ -XCOMM!/bin/sh +XCOMM!SHELL_CMD XCOMM $Xorg: startx.cpp,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ XCOMM @@ -13,28 +13,36 @@ XCOMM Site administrators are STRONGLY urged to write nicer versions. XCOMM XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $ -#ifdef SCO +#if defined(__SCO__) || defined(__UNIXWARE__) XCOMM Check for /usr/bin/X11 and BINDIR in the path, if not add them. XCOMM This allows startx to be placed in a place like /usr/bin or /usr/local/bin -XCOMM and people may use X without changing their PATH +XCOMM and people may use X without changing their PATH. +XCOMM Note that we put our own bin directory at the front of the path, and +XCOMM the standard SCO path at the back, since if you are using the Xorg +XCOMM server theres a pretty good chance you want to bias the Xorg clients +XCOMM over the old SCO X11R5 clients. XCOMM First our compiled path bindir=BINDIR -if expr $PATH : ".*`echo $bindir | sed 's?/?\\/?g'`.*" > /dev/null 2>&1; then - : -else - PATH=$PATH:BINDIR -fi +scobindir=/usr/bin/X11 + +case $PATH in + *:$bindir | *:$bindir:* | $bindir:*) ;; + *) PATH=$bindir:$PATH ;; +esac XCOMM Now the "SCO" compiled path -if expr $PATH : '.*\/usr\/bin\/X11.*' > /dev/null 2>&1; then - : -else - PATH=$PATH:/usr/bin/X11 -fi +case $PATH in + *:$scobindir | *:$scobindir:* | $scobindir:*) ;; + *) PATH=$PATH:$scobindir ;; +esac + +XCOMM Bourne shell doesn't automatically export modified environment variables +XCOMM so export the new PATH just in case the user changes the shell +export PATH XCOMM Set up the XMERGE env var so that dos merge is happy under X @@ -45,12 +53,16 @@ elif [ -f /usr/lib/merge/console.disp ]; then export XMERGE fi -scoclientrc=$HOME/.startxrc +userclientrc=$HOME/.startxrc +sysclientrc=LIBDIR/sys.startxrc +scouserclientrc=$HOME/.xinitrc +scosysclientrc=XINITDIR/xinitrc +#else +userclientrc=$HOME/.xinitrc +sysclientrc=XINITDIR/xinitrc #endif -userclientrc=$HOME/.xinitrc userserverrc=$HOME/.xserverrc -sysclientrc=XINITDIR/xinitrc sysserverrc=XINITDIR/xserverrc defaultclient=BINDIR/xterm defaultserver=BINDIR/X @@ -59,18 +71,31 @@ defaultserverargs="" clientargs="" serverargs="" -#ifdef SCO -if [ -f $scoclientrc ]; then - defaultclientargs=$scoclientrc -else -#endif if [ -f $userclientrc ]; then defaultclientargs=$userclientrc elif [ -f $sysclientrc ]; then defaultclientargs=$sysclientrc +#if defined(__SCO__) || defined(__UNIXWARE__) +elif [ -f $scouserclientrc ]; then + defaultclientargs=$scouserclientrc +elif [ -f $scosysclientrc ]; then + defaultclientargs=$scosysclientrc +#endif fi -#ifdef SCO -fi + +#if defined(__SCO__) || defined(__UNIXWARE__) + +XCOMM SCO -t option: do not start an X server +case $1 in + -t) if [ -n "$DISPLAY" ]; then + REMOTE_SERVER=TRUE + shift + else + echo "DISPLAY environment variable not set" + exit 1 + fi + ;; +esac #endif if [ -f $userserverrc ]; then @@ -175,16 +200,16 @@ XCOMM now add the same credentials to the client authority file XCOMM if '$displayname' already exists don't overwrite it as another XCOMM server man need it. Add them to the '$xserverauthfile' instead. for displayname in $authdisplay $hostname$authdisplay; do - authcookie=`xauth list "$displayname" @@ + authcookie=`BINDIR/xauth list "$displayname" @@ | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null; if [ "z${authcookie}" = "z" ] ; then - xauth -q << EOF + BINDIR/xauth -q << EOF add $displayname . $mcookie EOF removelist="$displayname $removelist" else dummy=$((dummy+1)); - xauth -q -f $xserverauthfile << EOF + BINDIR/xauth -q -f $xserverauthfile << EOF add :$dummy . $authcookie EOF fi @@ -192,10 +217,18 @@ done #endif -xinit $client $clientargs -- $server $display $serverargs +#if defined(__SCO__) || defined(__UNIXWARE__) +if [ "$REMOTE_SERVER" = "TRUE" ]; then + exec SHELL_CMD ${client} +else + BINDIR/xinit $client $clientargs -- $server $display $serverargs +fi +#else +BINDIR/xinit $client $clientargs -- $server $display $serverargs +#endif if [ x"$removelist" != x ]; then - xauth remove $removelist + BINDIR/xauth remove $removelist fi if [ x"$xserverauthfile" != x ]; then rm -f $xserverauthfile |