3
XCOMM $Xorg: startx.cpp,v 1.3 2000/08/17 19:54:29 cpqbld Exp $
5
XCOMM This is just a sample implementation of a slightly less primitive
6
XCOMM interface than xinit. It looks for user .xinitrc and .xserverrc
7
XCOMM files, then system xinitrc and xserverrc files, else lets xinit choose
8
XCOMM its default. The system xinitrc should probably do things like check
9
XCOMM for .Xresources files and merge them in, startup up a window manager,
10
XCOMM and pop a clock and serveral xterms.
12
XCOMM Site administrators are STRONGLY urged to write nicer versions.
14
XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.16 2003/01/24 21:30:02 herrb Exp $
18
XCOMM Check for /usr/bin/X11 and BINDIR in the path, if not add them.
19
XCOMM This allows startx to be placed in a place like /usr/bin or /usr/local/bin
20
XCOMM and people may use X without changing their PATH
22
XCOMM First our compiled path
25
if expr $PATH : ".*`echo $bindir | sed 's?/?\\/?g'`.*" > /dev/null 2>&1; then
31
XCOMM Now the "SCO" compiled path
33
if expr $PATH : '.*\/usr\/bin\/X11.*' > /dev/null 2>&1; then
36
PATH=$PATH:/usr/bin/X11
39
XCOMM Set up the XMERGE env var so that dos merge is happy under X
41
if [ -f /usr/lib/merge/xmergeset.sh ]; then
42
. /usr/lib/merge/xmergeset.sh
43
elif [ -f /usr/lib/merge/console.disp ]; then
44
XMERGE=`cat /usr/lib/merge/console.disp`
48
scoclientrc=$HOME/.startxrc
51
userclientrc=$HOME/.xinitrc
52
userserverrc=$HOME/.xserverrc
53
sysclientrc=XINITDIR/xinitrc
54
sysserverrc=XINITDIR/xserverrc
55
defaultclient=BINDIR/xterm
56
defaultserver=BINDIR/X
63
if [ -f $scoclientrc ]; then
64
defaultclientargs=$scoclientrc
67
if [ -f $userclientrc ]; then
68
defaultclientargs=$userclientrc
69
elif [ -f $sysclientrc ]; then
70
defaultclientargs=$sysclientrc
76
if [ -f $userserverrc ]; then
77
defaultserverargs=$userserverrc
78
elif [ -f $sysserverrc ]; then
79
defaultserverargs=$sysserverrc
83
while [ x"$1" != x ]; do
85
# '' required to prevent cpp from treating "/*" as a C comment.
87
if [ "$whoseargs" = "client" ]; then
88
if [ x"$clientargs" = x ]; then
91
clientargs="$clientargs $1"
94
if [ x"$serverargs" = x ]; then
97
serverargs="$serverargs $1"
105
if [ "$whoseargs" = "client" ]; then
106
clientargs="$clientargs $1"
108
# display must be the FIRST server argument
109
if [ x"$serverargs" = x ] && \
110
expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
113
serverargs="$serverargs $1"
121
XCOMM process client arguments
122
if [ x"$client" = x ]; then
123
# if no client arguments either, use rc file instead
124
if [ x"$clientargs" = x ]; then
125
client="$defaultclientargs"
127
client=$defaultclient
131
XCOMM process server arguments
132
if [ x"$server" = x ]; then
133
# if no server arguments or display either, use rc file instead
134
if [ x"$serverargs" = x -a x"$display" = x ]; then
135
server="$defaultserverargs"
137
server=$defaultserver
141
if [ x"$XAUTHORITY" = x ]; then
142
XAUTHORITY=$HOME/.Xauthority
148
#if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE)
149
XCOMM set up default Xauth info for this machine
152
if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
153
hostname=`hostname -f`
163
authdisplay=${display:-:0}
165
for displayname in $authdisplay $hostname$authdisplay; do
166
if ! xauth list "$displayname" | grep "$displayname " >/dev/null 2>&1; then
168
add $displayname . $mcookie
170
removelist="$displayname $removelist"
175
xinit $client $clientargs -- $server $display $serverargs
177
if [ x"$removelist" != x ]; then
178
xauth remove $removelist
182
* various machines need special cleaning up
185
if command -v deallocvt > /dev/null 2>&1; then
195
#if defined(sun) && !defined(i386)