From af47a9e0dd891dcaa52b12f4eda85381e0467916 Mon Sep 17 00:00:00 2001 From: Kean Johnson Date: Tue, 8 Nov 2005 06:33:33 +0000 Subject: See ChangeLog entry 2005-11-07 for details. --- startx.cpp | 89 ++++++++++++++++++++++++++++++++++++++++++------------------- startx.man | 29 ++++++++++++++++++++ xinitrc.cpp | 62 +++++++++++++++++++++++++++++++++++------- 3 files changed, 142 insertions(+), 38 deletions(-) diff --git a/startx.cpp b/startx.cpp index d085800..c5b7f77 100644 --- a/startx.cpp +++ b/startx.cpp @@ -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 diff --git a/startx.man b/startx.man index 559c6d0..3087db4 100644 --- a/startx.man +++ b/startx.man @@ -72,6 +72,23 @@ startx -- -dpi 100 .PP startx -- -layout Multihead .RE +#ifdef __SCOMAN__ +.PP +To determine the client to run, +.I startx +looks for the following files, in order: +.RS +.PP +.I $(HOME)/.startxrc +.PP +.I __libdir__/sys.startxrc +.PP +.I $(HOME)/.xinitrc +.PP +.I __xinitdir__/xinitrc +.RE +.PP +#else .PP To determine the client to run, .I startx @@ -83,6 +100,7 @@ the file in the .I xinit library directory. +#endif If command line client options are given, they override this behavior and revert to the .IR xinit (1) @@ -166,6 +184,17 @@ and .IR Xsecurity (__miscmansuffix__) manual pages for more information on X client/server authentication. .SH FILES +#ifdef __SCOMAN__ +.TP 25 +.I $(HOME)/.startxrc +Client to run. Typically a shell script which runs many programs in +the background. +.TP 25 +.I __libdir__/sys.startxrc +Client to use if the user has no +.I .startxrc +file. +#endif .TP 25 .I $(HOME)/.xinitrc Client to run. Typically a shell script which runs many programs in diff --git a/xinitrc.cpp b/xinitrc.cpp index 641eede..a145d7e 100644 --- a/xinitrc.cpp +++ b/xinitrc.cpp @@ -1,4 +1,4 @@ -XCOMM!/bin/sh +XCOMM!SHELL_CMD XCOMM $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ userresources=$HOME/.Xresources @@ -9,25 +9,67 @@ sysmodmap=XINITDIR/.Xmodmap XCOMM merge in defaults and keymaps if [ -f $sysresources ]; then - xrdb -merge $sysresources + BINDIR/xrdb -merge $sysresources fi if [ -f $sysmodmap ]; then - xmodmap $sysmodmap + BINDIR/xmodmap $sysmodmap fi if [ -f $userresources ]; then - xrdb -merge $userresources + BINDIR/xrdb -merge $userresources fi if [ -f $usermodmap ]; then - xmodmap $usermodmap + BINDIR/xmodmap $usermodmap fi XCOMM start some nice programs -twm & -xclock -geometry 50x50-1+1 & -xterm -geometry 80x50+494+51 & -xterm -geometry 80x20+494-0 & -exec xterm -geometry 80x66+0+0 -name login +#if defined(__SCO__) || defined(__UNIXWARE__) +if [ -r /etc/default/xdesktops ]; then + . /etc/default/xdesktops +fi + +if [ -r $HOME/.x11rc ]; then + . $HOME/.x11rc +else + if [ -r /etc/default/X11 ]; then + . /etc/default/X11 + fi +fi + +#if defined(__SCO__) +if [ -n "$XSESSION" ]; then + case "$XSESSION" in + [Yy][Ee][Ss]) + [ -x /usr/bin/X11/scosession ] && exec /usr/bin/X11/scosession + ;; + esac +fi + +if [ -n "$XDESKTOP" ]; then + exec `eval echo $"$XDESKTOP"` +else + if [ -x /usr/bin/X11/pmwm -a -x /usr/bin/X11/scoterm ]; then + /usr/bin/X11/scoterm 2> /dev/null & + exec /usr/bin/X11/pmwm 2> /dev/null + fi +fi +#elif defined(__UNIXWARE__) +if [ -n "$XDESKTOP" ]; then + exec `eval echo $"$XDESKTOP"` +else + if [ -x /usr/X/bin/pmwm ]; then + exec /usr/X/bin/pmwm 2> /dev/null + fi +fi +#endif + +XCOMM This is the fallback case if nothing else is executed above +#endif /* !defined(__SCO__) && !defined(__UNIXWARE__) */ +BINDIR/twm & +BINDIR/xclock -geometry 50x50-1+1 & +BINDIR/xterm -geometry 80x50+494+51 & +BINDIR/xterm -geometry 80x20+494-0 & +exec BINDIR/xterm -geometry 80x66+0+0 -name login -- cgit v1.2.3