14
14
XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $
16
#if defined(__SCO__) || defined(__UNIXWARE__)
16
#if defined(__SCO__) || defined(__UNIXWARE__) || defined(__APPLE__)
18
18
XCOMM Check for /usr/bin/X11 and BINDIR in the path, if not add them.
19
19
XCOMM This allows startx to be placed in a place like /usr/bin or /usr/local/bin
20
20
XCOMM and people may use X without changing their PATH.
21
21
XCOMM Note that we put our own bin directory at the front of the path, and
22
XCOMM the standard SCO path at the back, since if you are using the Xorg
22
XCOMM the standard system path at the back, since if you are using the Xorg
23
23
XCOMM server theres a pretty good chance you want to bias the Xorg clients
24
XCOMM over the old SCO X11R5 clients.
24
XCOMM over the old system's clients.
26
26
XCOMM First our compiled path
29
scobindir=/usr/bin/X11
32
*:$bindir | *:$bindir:* | $bindir:*) ;;
33
*) PATH=$bindir:$PATH ;;
36
XCOMM Now the "SCO" compiled path
39
*:$scobindir | *:$scobindir:* | $scobindir:*) ;;
40
*) PATH=$PATH:$scobindir ;;
30
*:$bindir | *:$bindir:* | $bindir:*) ;;
31
*) PATH=$bindir:$PATH ;;
34
XCOMM Now the "old" compiled path
36
oldbindir=/usr/X11R6/bin
38
oldbindir=/usr/bin/X11
41
if [ -d "$oldbindir" ] ; then
43
*:$oldbindir | *:$oldbindir:* | $oldbindir:*) ;;
44
*) PATH=$PATH:$oldbindir ;;
43
48
XCOMM Bourne shell does not automatically export modified environment variables
44
49
XCOMM so export the new PATH just in case the user changes the shell
53
#if defined(__SCO__) || defined(__UNIXWARE__)
47
54
XCOMM Set up the XMERGE env var so that dos merge is happy under X
49
56
if [ -f /usr/lib/merge/xmergeset.sh ]; then
83
XCOMM Initialize defaults (this will cut down on "safe" error messages)
84
if ! defaults read org.x.X11 cache_fonts >& /dev/null ; then
85
defaults write org.x.X11 cache_fonts -bool true
88
if ! defaults read org.x.X11 no_auth >& /dev/null ; then
89
defaults write org.x.X11 no_auth -bool false
92
if ! defaults read org.x.X11 nolisten_tcp >& /dev/null ; then
93
defaults write org.x.X11 nolisten_tcp -bool true
96
XCOMM First, start caching fonts
97
if [ x`defaults read org.x.X11 cache_fonts` = x1 ] ; then
98
if [ -x /usr/X11/bin/font_cache.sh ] ; then
99
/usr/X11/bin/font_cache.sh &
100
elif [ -x /usr/X11/bin/fc-cache ] ; then
101
/usr/X11/bin/fc-cache &
105
if [ x`defaults read org.x.X11 no_auth` = x0 ] ; then
111
if [ x`defaults read org.x.X11 nolisten_tcp` = x1 ] ; then
112
defaultserverargs="$defaultserverargs -nolisten tcp"
115
for ((d=0; ; d++)) ; do
116
[[ -e /tmp/.X$d-lock ]] || break
74
125
if [ -f $userclientrc ]; then
75
126
defaultclientargs=$userclientrc
76
127
elif [ -f $sysclientrc ]; then
158
209
XCOMM if no server arguments or display either, use rc file instead
159
210
if [ x"$serverargs" = x -a x"$display" = x ]; then
160
211
server="$defaultserverargs"
213
display="$defaultdisplay"
162
216
server=$defaultserver
166
if [ x"$XAUTHORITY" = x ]; then
167
XAUTHORITY=$HOME/.Xauthority
173
XCOMM set up default Xauth info for this machine
176
if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
177
hostname=`hostname -f`
187
authdisplay=${display:-:0}
220
if [ x"$enable_xauth" = x1 ] ; then
221
if [ x"$XAUTHORITY" = x ]; then
222
XAUTHORITY=$HOME/.Xauthority
228
XCOMM set up default Xauth info for this machine
231
if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
232
hostname=`hostname -f`
242
authdisplay=${display:-:0}
188
243
#if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE)
191
mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
192
if test x"$mcookie" = x; then
193
echo "Couldn't create cookie"
246
mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
247
if test x"$mcookie" = x; then
248
echo "Couldn't create cookie"
199
XCOMM create a file with auth information for the server. ':0' is a dummy.
200
xserverauthfile=$HOME/.serverauth.$$
201
trap "rm -f $xserverauthfile" HUP INT QUIT ILL TRAP KILL BUS TERM
202
xauth -q -f $xserverauthfile << EOF
254
XCOMM create a file with auth information for the server. ':0' is a dummy.
255
xserverauthfile=$HOME/.serverauth.$$
256
trap "rm -f $xserverauthfile" HUP INT QUIT ILL TRAP KILL BUS TERM
257
xauth -q -f $xserverauthfile << EOF
203
258
add :$dummy . $mcookie
205
serverargs=${serverargs}" -auth "${xserverauthfile}
260
serverargs=${serverargs}" -auth "${xserverauthfile}
207
XCOMM now add the same credentials to the client authority file
208
XCOMM if '$displayname' already exists do not overwrite it as another
209
XCOMM server man need it. Add them to the '$xserverauthfile' instead.
210
for displayname in $authdisplay $hostname$authdisplay; do
211
authcookie=`XAUTH list "$displayname" @@
212
| sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
213
if [ "z${authcookie}" = "z" ] ; then
262
XCOMM now add the same credentials to the client authority file
263
XCOMM if '$displayname' already exists do not overwrite it as another
264
XCOMM server man need it. Add them to the '$xserverauthfile' instead.
265
for displayname in $authdisplay $hostname$authdisplay; do
266
authcookie=`XAUTH list "$displayname" @@
267
| sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
268
if [ "z${authcookie}" = "z" ] ; then
215
270
add $displayname . $mcookie
217
removelist="$displayname $removelist"
220
XAUTH -q -f $xserverauthfile << EOF
272
removelist="$displayname $removelist"
275
XAUTH -q -f $xserverauthfile << EOF
221
276
add :$dummy . $authcookie
226
282
#if defined(__SCO__) || defined(__UNIXWARE__)
227
283
if [ "$REMOTE_SERVER" = "TRUE" ]; then