head	1.12;
access;
symbols
	netbsd-11-0-RELEASE:1.12
	netbsd-11-0-RC7:1.12
	netbsd-11-0-RC6:1.12
	netbsd-11-0-RC5:1.12
	netbsd-11-0-RC4:1.12
	netbsd-11-0-RC3:1.12
	netbsd-11-0-RC2:1.12
	netbsd-11-0-RC1:1.12
	netbsd-11:1.12.0.2
	netbsd-11-base:1.12
	xinit-1-4-3:1.1.1.11
	netbsd-10-1-RELEASE:1.9
	netbsd-8-3-RELEASE:1.7
	netbsd-9-4-RELEASE:1.8.2.1
	netbsd-10-0-RELEASE:1.9
	netbsd-10-0-RC6:1.9
	netbsd-10-0-RC5:1.9
	netbsd-10-0-RC4:1.9
	netbsd-10-0-RC3:1.9
	netbsd-10-0-RC2:1.9
	netbsd-10-0-RC1:1.9
	xinit-1-4-2:1.1.1.10
	netbsd-10:1.9.0.2
	netbsd-10-base:1.9
	netbsd-9-3-RELEASE:1.8.2.1
	netbsd-9-2-RELEASE:1.8
	netbsd-9-1-RELEASE:1.8
	netbsd-8-2-RELEASE:1.7
	netbsd-9-0-RELEASE:1.8
	netbsd-9-0-RC2:1.8
	netbsd-9-0-RC1:1.8
	netbsd-9:1.8.0.2
	netbsd-9-base:1.8
	netbsd-8-1-RELEASE:1.7
	netbsd-8-1-RC1:1.7
	xinit-1-4-1:1.1.1.9
	netbsd-7-2-RELEASE:1.4
	netbsd-8-0-RELEASE:1.7
	netbsd-8-0-RC2:1.7
	netbsd-8-0-RC1:1.7
	netbsd-7-1-2-RELEASE:1.4
	xinit-1-4-0:1.1.1.9
	netbsd-7-1-1-RELEASE:1.4
	netbsd-8:1.7.0.2
	netbsd-8-base:1.7
	netbsd-7-1:1.4.0.6
	netbsd-7-1-RELEASE:1.4
	netbsd-7-1-RC2:1.4
	netbsd-7-1-RC1:1.4
	netbsd-7-0-2-RELEASE:1.4
	netbsd-7-0-1-RELEASE:1.4
	netbsd-7-0:1.4.0.4
	netbsd-7-0-RELEASE:1.4
	netbsd-7-0-RC3:1.4
	netbsd-7-0-RC2:1.4
	xinit-1-3-4:1.1.1.8
	netbsd-7-0-RC1:1.4
	netbsd-5-2-3-RELEASE:1.1.1.1.2.1
	netbsd-5-1-5-RELEASE:1.1.1.1.2.1
	netbsd-6-0-6-RELEASE:1.1.1.5.2.1
	netbsd-6-1-5-RELEASE:1.1.1.5.2.1
	netbsd-7:1.4.0.2
	netbsd-7-base:1.4
	netbsd-6-1-4-RELEASE:1.1.1.5.2.1
	netbsd-6-0-5-RELEASE:1.1.1.5.2.1
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.4
	xinit-1-3-3:1.1.1.7
	riastradh-drm2:1.3.0.2
	riastradh-drm2-base:1.3
	netbsd-6-1-3-RELEASE:1.1.1.5.2.1
	netbsd-6-0-4-RELEASE:1.1.1.5.2.1
	netbsd-5-2-2-RELEASE:1.1.1.1.2.1
	netbsd-5-1-4-RELEASE:1.1.1.1.2.1
	netbsd-6-1-2-RELEASE:1.1.1.5.2.1
	netbsd-6-0-3-RELEASE:1.1.1.5.2.1
	netbsd-5-2-1-RELEASE:1.1.1.1.2.1
	netbsd-5-1-3-RELEASE:1.1.1.1.2.1
	netbsd-6-1-1-RELEASE:1.1.1.5.2.1
	xinit-1-3-2:1.1.1.6
	netbsd-6-1:1.1.1.5.2.1.0.4
	netbsd-6-0-2-RELEASE:1.1.1.5.2.1
	netbsd-6-1-RELEASE:1.1.1.5.2.1
	netbsd-6-1-RC4:1.1.1.5.2.1
	netbsd-6-1-RC3:1.1.1.5.2.1
	netbsd-6-1-RC2:1.1.1.5.2.1
	netbsd-6-1-RC1:1.1.1.5.2.1
	netbsd-5-2:1.1.1.1.2.1.0.4
	netbsd-6-0-1-RELEASE:1.1.1.5.2.1
	netbsd-5-2-RELEASE:1.1.1.1.2.1
	netbsd-5-2-RC1:1.1.1.1.2.1
	netbsd-6-0:1.1.1.5.2.1.0.2
	netbsd-6-0-RELEASE:1.1.1.5.2.1
	netbsd-6-0-RC2:1.1.1.5.2.1
	netbsd-6-0-RC1:1.1.1.5.2.1
	netbsd-6:1.1.1.5.0.2
	netbsd-6-base:1.1.1.5
	netbsd-5-1-2-RELEASE:1.1.1.1.2.1
	netbsd-5-1-1-RELEASE:1.1.1.1.2.1
	xinit-1-3-1:1.1.1.5
	xinit-1-3-0:1.1.1.4
	netbsd-5-1:1.1.1.1.2.1.0.2
	netbsd-5-1-RELEASE:1.1.1.1.2.1
	netbsd-5-1-RC4:1.1.1.1.2.1
	netbsd-5-1-RC3:1.1.1.1.2.1
	xinit-1-2-1:1.1.1.3
	netbsd-5-1-RC2:1.1.1.1.2.1
	netbsd-5-1-RC1:1.1.1.1.2.1
	netbsd-5-0-2-RELEASE:1.1.1.1
	netbsd-5-0-1-RELEASE:1.1.1.1
	netbsd-5-0:1.1.1.1.0.4
	netbsd-5-0-RELEASE:1.1.1.1
	netbsd-5-0-RC4:1.1.1.1
	netbsd-5-0-RC3:1.1.1.1
	xinit-1-1-1:1.1.1.2
	netbsd-5-0-RC2:1.1.1.1
	netbsd-5-0-RC1:1.1.1.1
	netbsd-5:1.1.1.1.0.2
	netbsd-5-base:1.1.1.1
	xinit-1-1-0:1.1.1.1
	xorg:1.1.1;
locks; strict;
comment	@// @;


1.12
date	2025.03.09.08.45.08;	author mrg;	state Exp;
branches;
next	1.11;
commitid	gtelTpah1DfZ0nMF;

1.11
date	2025.03.09.08.09.32;	author mrg;	state Exp;
branches;
next	1.10;
commitid	8TsdhjDbFM4XOmMF;

1.10
date	2023.01.08.09.59.51;	author mrg;	state Exp;
branches;
next	1.9;
commitid	IdgwI6ndJlf7RI8E;

1.9
date	2022.04.07.20.28.49;	author nia;	state Exp;
branches;
next	1.8;
commitid	03ZC0hXhLmL3djzD;

1.8
date	2018.03.11.10.46.02;	author mrg;	state Exp;
branches
	1.8.2.1;
next	1.7;
commitid	Fg20tSni1cIzO1uA;

1.7
date	2015.07.28.15.45.46;	author wiz;	state Exp;
branches;
next	1.6;
commitid	MOZcJCc52b9Ae4vy;

1.6
date	2015.07.22.09.16.23;	author mrg;	state Exp;
branches;
next	1.5;
commitid	qKveELSYbThMgguy;

1.5
date	2015.07.22.08.36.10;	author mrg;	state Exp;
branches;
next	1.4;
commitid	7IiMghQdOMX23guy;

1.4
date	2014.03.17.09.43.11;	author mrg;	state Exp;
branches;
next	1.3;
commitid	HElDGbkwDonie2tx;

1.3
date	2013.05.31.07.21.57;	author mrg;	state Exp;
branches;
next	1.2;
commitid	FS8SVHWMxXlWLKRw;

1.2
date	2012.02.18.08.54.21;	author martin;	state Exp;
branches;
next	1.1;

1.1
date	2008.07.30.04.21.00;	author mrg;	state Exp;
branches
	1.1.1.1;
next	;

1.8.2.1
date	2022.04.25.12.38.38;	author martin;	state Exp;
branches;
next	;
commitid	kEK4fjBgJhUU1ABD;

1.1.1.1
date	2008.07.30.04.21.00;	author mrg;	state Exp;
branches
	1.1.1.1.2.1;
next	1.1.1.2;

1.1.1.2
date	2009.03.09.05.01.12;	author mrg;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2010.05.22.21.15.56;	author mrg;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2010.11.21.03.47.48;	author mrg;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	2011.08.03.02.44.52;	author mrg;	state Exp;
branches
	1.1.1.5.2.1;
next	1.1.1.6;

1.1.1.6
date	2013.05.31.07.18.27;	author mrg;	state Exp;
branches;
next	1.1.1.7;
commitid	nH1SxLpKlv70LKRw;

1.1.1.7
date	2014.03.17.09.37.35;	author mrg;	state Exp;
branches;
next	1.1.1.8;
commitid	VBCSl7bGH4VMc2tx;

1.1.1.8
date	2015.07.22.08.34.41;	author mrg;	state Exp;
branches;
next	1.1.1.9;
commitid	9xxantJ6N8KH2guy;

1.1.1.9
date	2018.03.11.10.45.05;	author mrg;	state Exp;
branches;
next	1.1.1.10;
commitid	wiCIC53MwE0hO1uA;

1.1.1.10
date	2023.01.08.09.54.59;	author mrg;	state Exp;
branches;
next	1.1.1.11;
commitid	o8BBbM4vuG1CPI8E;

1.1.1.11
date	2025.03.09.07.58.32;	author mrg;	state Exp;
branches;
next	;
commitid	m0Z5Btu96vshLmMF;

1.1.1.1.2.1
date	2009.09.17.03.34.37;	author snj;	state Exp;
branches;
next	;

1.1.1.5.2.1
date	2012.03.07.23.29.52;	author riz;	state Exp;
branches;
next	;


desc
@@


1.12
log
@revert a portion of the previous, which ends up failing with our
MK_COOKIE definition now being a variable instead of cpp expanded
directly into the script.

startx now starts up the X server again.

XXX.
@
text
@XCOMM!SHELL_CMD

XCOMM
XCOMM This is just a sample implementation of a slightly less primitive
XCOMM interface than xinit.  It looks for XINITRC and XSERVERRC environment
XCOMM variables, then user .xinitrc and .xserverrc files, and then system
XCOMM xinitrc and xserverrc files, else lets xinit choose its default.
XCOMM The system xinitrc should probably do things like check for
XCOMM .Xresources files and merge them in, start up a window manager, and
XCOMM pop a clock and several xterms.
XCOMM
XCOMM Site administrators are STRONGLY urged to write nicer versions.
XCOMM

xinitdir=XINITDIR
xterm=XTERM
xserver=XSERVER
xinit=XINIT
bundle_id_prefix=BUNDLE_ID_PREFIX
xauth=XAUTH
bindir=__bindir__
libexecdir=__libexecdir__
# XXX using $mk_cookie here expands bad.
# mk_cookie=MK_COOKIE
has_cookie_maker=HAS_COOKIE_MAKER

unset SESSION_MANAGER

if [ "$(uname -s)" = "Darwin" ] ; then

    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 Note that we put our own bin directory at the front of the path, and
    XCOMM the standard system path at the back, since if you are using the Xorg
    XCOMM server there's a pretty good chance you want to bias the Xorg clients
    XCOMM over the old system's clients.

    case $PATH in
        *:$bindir | *:$bindir:* | $bindir:*) ;;
        *) PATH=$bindir:$PATH ;;
    esac

    XCOMM Now the "old" compiled path
    oldbindir=/usr/X11R6/bin

    if [ -d "$oldbindir" ] ; then
        case $PATH in
            *:$oldbindir | *:$oldbindir:* | $oldbindir:*) ;;
            *) PATH=$PATH:$oldbindir ;;
        esac
    fi

    XCOMM Bourne shell does not automatically export modified environment variables
    XCOMM so export the new PATH just in case the user changes the shell
    export PATH
fi

userclientrc=$HOME/.xinitrc
[ -f "${XINITRC}" ] && userclientrc="${XINITRC}"
sysclientrc=XINITDIR/xinitrc

userserverrc=$HOME/.xserverrc
[ -f "${XSERVERRC}" ] && userserverrc="${XSERVERRC}"
sysserverrc=$xinitdir/xserverrc
defaultclient=$xterm
defaultserver=$xserver
defaultclientargs=""
defaultserverargs="-noretro"
defaultdisplay=""
clientargs=""
serverargs=""
vtarg=""


if [ "$(uname -s)" = "Darwin" ] ; then

    if [ "$X11_PREFS_DOMAIN" = "" ] ; then
        export X11_PREFS_DOMAIN=$bundle_id_prefix".X11"
    fi

    XCOMM Initialize defaults (this will cut down on "safe" error messages)
    if ! defaults read $X11_PREFS_DOMAIN cache_fonts > /dev/null 2>&1 ; then
        defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
    fi

    if ! defaults read $X11_PREFS_DOMAIN no_auth > /dev/null 2>&1 ; then
        defaults write $X11_PREFS_DOMAIN no_auth -bool false
    fi

    if ! defaults read $X11_PREFS_DOMAIN nolisten_tcp > /dev/null 2>&1 ; then
        defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
    fi

    if ! defaults read $X11_PREFS_DOMAIN enable_iglx > /dev/null 2>&1 ; then
        defaults write $X11_PREFS_DOMAIN enable_iglx -bool false
    fi

    XCOMM First, start caching fonts
    if [ "$(defaults read $X11_PREFS_DOMAIN cache_fonts)" = 1 ] ; then
        if [ -x $bindir/font_cache ] ; then
            $bindir/font_cache
        elif [ -x $bindir/font_cache.sh ] ; then
            $bindir/font_cache.sh
        elif [ -x $bindir/fc-cache ] ; then
            $bindir/fc-cache
        fi
    fi

    if [ -x $libexecdir/privileged_startx ] ; then
	XCOMM Don't push this into the background because it can cause
	XCOMM a race to create /tmp/.X11-unix
	$libexecdir/privileged_startx
    fi

    if [ "$(defaults read $X11_PREFS_DOMAIN no_auth)" = 0 ] ; then
        enable_xauth=1
    else
        enable_xauth=0
    fi

    if [ "$(defaults read $X11_PREFS_DOMAIN nolisten_tcp)" = 1 ] ; then
        defaultserverargs="$defaultserverargs -nolisten tcp"
    else
        defaultserverargs="$defaultserverargs -listen tcp"
    fi

    if [ "$(defaults read $X11_PREFS_DOMAIN enable_iglx)" = 1 ] ; then
        defaultserverargs="$defaultserverargs +iglx +extension GLX"
    else
        defaultserverargs="$defaultserverargs -iglx"
    fi

    XCOMM The second check is the real one.  The first is to hopefully avoid
    XCOMM needless syslog spamming.
    if defaults read $X11_PREFS_DOMAIN 2> /dev/null | grep -q 'dpi' && defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
        defaultserverargs="$defaultserverargs -dpi $(defaults read $X11_PREFS_DOMAIN dpi)"
    fi

else
    enable_xauth=1
fi

XCOMM Automatically determine an unused $DISPLAY
d=0
while true ; do
    [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] || break
    d=$(($d + 1))
done
defaultdisplay=":$d"
unset d

whoseargs="client"
while [ "$1" != "" ]; do
    case "$1" in
    XCOMM '' required to prevent cpp from treating "/*" as a C comment.
    /''*|\./''*)
	if [ "$whoseargs" = "client" ]; then
	    if [ "$client" = "" ] && [ "$clientargs" = "" ]; then
		client="$1"
	    else
		clientargs="$clientargs $1"
	    fi
	else
	    if [ "$server" = "" ] && [ "$serverargs" = "" ]; then
		server="$1"
	    else
		serverargs="$serverargs $1"
	    fi
	fi
	;;
    --)
	whoseargs="server"
	;;
    *)
	if [ "$whoseargs" = "client" ]; then
	    clientargs="$clientargs $1"
	else
	    XCOMM display must be the FIRST server argument
	    if [ "$serverargs" = "" ] && @@@@
		 expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
		display="$1"
	    else
		serverargs="$serverargs $1"
	    fi
	fi
	;;
    esac
    shift
done

XCOMM process client arguments
if [ "$client" = "" ]; then
    client=$defaultclient

    XCOMM For compatibility reasons, only use startxrc if there were no client command line arguments
    if [ "$clientargs" = "" ]; then
        if [ -f "$userclientrc" ]; then
            client=$userclientrc
        elif [ -f "$sysclientrc" ]; then
            client=$sysclientrc
        fi
    fi
fi

XCOMM if no client arguments, use defaults
if [ "$clientargs" = "" ]; then
    clientargs=$defaultclientargs
fi

XCOMM process server arguments
if [ "$server" = "" ]; then
    server=$defaultserver

if [ "$(uname -s)" = "Linux" ] ; then
    XCOMM When starting the defaultserver start X on the current tty to avoid
    XCOMM the startx session being seen as inactive:
    XCOMM "https://bugzilla.redhat.com/show_bug.cgi?id=806491"
    tty=$(tty)
    if expr "$tty" : '/dev/tty[0-9][0-9]*$' > /dev/null; then
        tty_num=${tty#/dev/tty}
        vtarg="vt$tty_num -keeptty"
    fi
fi

    XCOMM For compatibility reasons, only use xserverrc if there were no server command line arguments
    if [ "$serverargs" = "" ] && [ "$display" = "" ]; then
	if [ -f "$userserverrc" ]; then
	    server=$userserverrc
	elif [ -f "$sysserverrc" ]; then
	    server=$sysserverrc
	fi
    fi
fi

XCOMM if no server arguments, use defaults
if [ "$serverargs" = "" ]; then
    serverargs=$defaultserverargs
fi

XCOMM if no vt is specified add vtarg (which may be empty)
have_vtarg="no"
for i in $serverargs; do
    if expr "$i" : 'vt[0-9][0-9]*$' > /dev/null; then
        have_vtarg="yes"
    fi
done
if [ "$have_vtarg" = "no" ]; then
    serverargs="$serverargs $vtarg"
fi

XCOMM if no display, use default
if [ "$display" = "" ]; then
    display=$defaultdisplay
fi

if [ "$enable_xauth" = 1 ] ; then
    if [ "$XAUTHORITY" = "" ]; then
        XAUTHORITY=$HOME/.Xauthority
        export XAUTHORITY
    fi

    removelist=

    XCOMM set up default Xauth info for this machine
    hostname="$(uname -n)"

    authdisplay=${display:-:0}
    if [ -n "$has_cookie_maker" ] && [ -n 'MK_COOKIE' ] ; then
        mcookie=`MK_COOKIE`
    else
        if [ -r /dev/urandom ]; then
            mcookie=$(dd if=dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\")
        else
            mcookie=$(dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\")
        fi
    fi
    if [ "$mcookie" = "" ]; then
        echo "Couldn't create cookie"
        exit 1
    fi
    dummy=0

    XCOMM create a file with auth information for the server. ':0' is a dummy.
    xserverauthfile=$HOME/.serverauth.$$
    trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM
    xauth -q -f "$xserverauthfile" << EOF
add :$dummy . $mcookie
EOF

    case "$(uname -s)" in
    CYGWIN*|Darwin)
        xserverauthfilequoted=$(echo ${xserverauthfile} | sed "s/'/'\\\\''/g")
        serverargs=${serverargs}" -auth '"${xserverauthfilequoted}"'"
        ;;
    *)
        serverargs=${serverargs}" -auth "${xserverauthfile}
        ;;
    esac

    XCOMM now add the same credentials to the client authority file
    XCOMM if '$displayname' already exists do not overwrite it as another
    XCOMM server may need it. Add them to the '$xserverauthfile' instead.
    for displayname in $authdisplay $hostname$authdisplay; do
        authcookie=$(xauth list "$displayname" @@@@
        | sed -n 's/.*'"$displayname"'[[:space:]*].*[[:space:]*]//p' 2>/dev/null);
        if [ "z${authcookie}" = "z" ] ; then
            $xauth -q << EOF
add $displayname . $mcookie
EOF
        removelist="$displayname $removelist"
        else
            dummy=$(($dummy+1));
            $xauth -q -f "$xserverauthfile" << EOF
add :$dummy . $authcookie
EOF
        fi
    done
fi

case "$(uname -s)" in
CYGWIN_NT*|Darwin)
    eval $xinit \"$client\" $clientargs -- \"$server\" $display $serverargs
    ;;
*)
    $xinit "$client" $clientargs -- "$server" $display $serverargs
    ;;
esac
retval=$?

if [ "$enable_xauth" = 1 ] ; then
    if [ "$removelist" != "" ]; then
        $xauth remove $removelist
    fi
    if [ "$xserverauthfile" != "" ]; then
        rm -f "$xserverauthfile"
    fi
fi

XCOMM various machines need special cleaning up
if [ "$(uname -s)" = "Linux" ]; then
    if command -v deallocvt > /dev/null 2>&1; then
        deallocvt
    fi
fi

if [ "$(uname -s)" = "SunOS" ]; then
    kbd_mode -a
fi

exit $retval
@


1.11
log
@merge xauth-1.1.4, xdm-1.1.17, xinit-1.4.3, and xtrans-1.6.0.
@
text
@d23 2
a24 1
mk_cookie=MK_COOKIE
d269 2
a270 2
    if [ -n "$has_cookie_maker" ] && [ -n "$mk_cookie" ] ; then
        mcookie=$($mk_cookie)
@


1.10
log
@merge xinit 1.4.2, xprop 1.2.6, xrandr 1.5.2, xset 1.2.5, and xstdcmap 1.0.5
@
text
@d15 11
d28 1
a28 1
#ifdef __APPLE__
d30 7
a36 7
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 Note that we put our own bin directory at the front of the path, and
XCOMM the standard system path at the back, since if you are using the Xorg
XCOMM server there's a pretty good chance you want to bias the Xorg clients
XCOMM over the old system's clients.
d38 4
a41 2
XCOMM First our compiled path
bindir=__bindir__
d43 2
a44 4
case $PATH in
    *:$bindir | *:$bindir:* | $bindir:*) ;;
    *) PATH=$bindir:$PATH ;;
esac
d46 6
a51 2
XCOMM Now the "old" compiled path
oldbindir=/usr/X11R6/bin
d53 3
a55 5
if [ -d "$oldbindir" ] ; then
    case $PATH in
        *:$oldbindir | *:$oldbindir:* | $oldbindir:*) ;;
        *) PATH=$PATH:$oldbindir ;;
    esac
a57 5
XCOMM Bourne shell does not automatically export modified environment variables
XCOMM so export the new PATH just in case the user changes the shell
export PATH
#endif

d63 4
a66 4
[ -f "${XSERVERRC}" ] && userclientrc="${XSERVERRC}"
sysserverrc=XINITDIR/xserverrc
defaultclient=XTERM
defaultserver=XSERVER
a73 1
#ifdef __APPLE__
d75 5
a79 3
if [ "x$X11_PREFS_DOMAIN" = x ] ; then
    export X11_PREFS_DOMAIN=BUNDLE_ID_PREFIX".X11"
fi
d81 4
a84 4
XCOMM Initialize defaults (this will cut down on "safe" error messages)
if ! defaults read $X11_PREFS_DOMAIN cache_fonts > /dev/null 2>&1 ; then
    defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
fi
d86 3
a88 3
if ! defaults read $X11_PREFS_DOMAIN no_auth > /dev/null 2>&1 ; then
    defaults write $X11_PREFS_DOMAIN no_auth -bool false
fi
d90 3
a92 3
if ! defaults read $X11_PREFS_DOMAIN nolisten_tcp > /dev/null 2>&1 ; then
    defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
fi
d94 3
a96 3
if ! defaults read $X11_PREFS_DOMAIN enable_iglx > /dev/null 2>&1 ; then
    defaults write $X11_PREFS_DOMAIN enable_iglx -bool false
fi
d98 9
a106 8
XCOMM First, start caching fonts
if [ x`defaults read $X11_PREFS_DOMAIN cache_fonts` = x1 ] ; then
    if [ -x $bindir/font_cache ] ; then
        $bindir/font_cache
    elif [ -x $bindir/font_cache.sh ] ; then
        $bindir/font_cache.sh
    elif [ -x $bindir/fc-cache ] ; then
        $bindir/fc-cache
a107 1
fi
d109 1
a109 1
if [ -x __libexecdir__/privileged_startx ] ; then
d112 14
a125 2
	__libexecdir__/privileged_startx
fi
d127 5
a131 5
if [ x`defaults read $X11_PREFS_DOMAIN no_auth` = x0 ] ; then
    enable_xauth=1
else
    enable_xauth=0
fi
d133 5
a137 5
if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
    defaultserverargs="$defaultserverargs -nolisten tcp"
else
    defaultserverargs="$defaultserverargs -listen tcp"
fi
a138 2
if [ x`defaults read $X11_PREFS_DOMAIN enable_iglx` = x1 ] ; then
    defaultserverargs="$defaultserverargs +iglx +extension GLX"
d140 1
a140 7
    defaultserverargs="$defaultserverargs -iglx"
fi

XCOMM The second check is the real one.  The first is to hopefully avoid
XCOMM needless syslog spamming.
if defaults read $X11_PREFS_DOMAIN 2> /dev/null | grep -q 'dpi' && defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
    defaultserverargs="$defaultserverargs -dpi `defaults read $X11_PREFS_DOMAIN dpi`"
a142 4
#else
enable_xauth=1
#endif

d153 1
a153 1
while [ x"$1" != x ]; do
d158 1
a158 1
	    if [ x"$client" = x ] && [ x"$clientargs" = x ]; then
d164 1
a164 1
	    if [ x"$server" = x ] && [ x"$serverargs" = x ]; then
d179 1
a179 1
	    if [ x"$serverargs" = x ] && @@@@
d192 1
a192 1
if [ x"$client" = x ]; then
d196 1
a196 1
    if [ x"$clientargs" = x ]; then
d206 1
a206 1
if [ x"$clientargs" = x ]; then
d211 1
a211 1
if [ x"$server" = x ]; then
d214 1
a214 1
#ifdef __linux__
d223 1
a223 1
#endif
d226 1
a226 1
    if [ x"$serverargs" = x -a x"$display" = x ]; then
d236 1
a236 1
if [ x"$serverargs" = x ]; then
d252 1
a252 1
if [ x"$display" = x ]; then
d256 2
a257 2
if [ x"$enable_xauth" = x1 ] ; then
    if [ x"$XAUTHORITY" = x ]; then
d265 1
a265 1
    hostname=`uname -n`
d268 2
a269 5
#if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE)
    mcookie=`MK_COOKIE`
#else
    if [ -r /dev/urandom ]; then
        mcookie=`dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
d271 5
a275 1
        mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
d277 1
a277 2
#endif
    if test x"$mcookie" = x; then
d289 10
a298 6
#if defined(__APPLE__) || defined(__CYGWIN__)
    xserverauthfilequoted=$(echo ${xserverauthfile} | sed "s/'/'\\\\''/g")
    serverargs=${serverargs}" -auth '"${xserverauthfilequoted}"'"
#else
    serverargs=${serverargs}" -auth "${xserverauthfile}
#endif
d304 2
a305 2
        authcookie=`XAUTH list "$displayname" @@@@
        | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
d307 1
a307 1
            XAUTH -q << EOF 
d313 1
a313 1
            XAUTH -q -f "$xserverauthfile" << EOF
d320 8
a327 5
#if defined(__APPLE__) || defined(__CYGWIN__)
eval XINIT \"$client\" $clientargs -- \"$server\" $display $serverargs
#else
XINIT "$client" $clientargs -- "$server" $display $serverargs
#endif
d330 3
a332 3
if [ x"$enable_xauth" = x1 ] ; then
    if [ x"$removelist" != x ]; then
        XAUTH remove $removelist
d334 1
a334 1
    if [ x"$xserverauthfile" != x ]; then
d339 10
a348 12
/*
 * various machines need special cleaning up
 */
#ifdef __linux__
if command -v deallocvt > /dev/null 2>&1; then
    deallocvt
fi
#endif

#if defined(sun)
kbd_mode -a
#endif
a350 1

@


1.9
log
@Do not attempt to trap SIGKILL
@
text
@d5 6
a10 5
XCOMM interface than xinit.  It looks for user .xinitrc and .xserverrc
XCOMM files, then system xinitrc and xserverrc files, else lets xinit choose
XCOMM its default.  The system xinitrc should probably do things like check
XCOMM for .Xresources files and merge them in, start up a window manager,
XCOMM and pop a clock and several xterms.
a14 1
unset DBUS_SESSION_BUS_ADDRESS
d51 1
d55 1
d92 1
a92 1
        $bindir/font_cache &
d94 1
a94 1
        $bindir/font_cache.sh &
d96 1
a96 1
        $bindir/fc-cache &
d101 2
a102 2
	# Don't push this into the background becasue it can cause
	# a race to create /tmp/.X11-unix
d119 1
a119 1
    defaultserverargs="$defaultserverargs +iglx"
d211 1
a211 1
        tty_num=$(echo "$tty" | grep -oE '[0-9]+$')
d256 1
a256 12
    case `uname` in
    Linux*)
        if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
            hostname=`hostname -f`
        else
            hostname=`hostname`
        fi
        ;;
    *)
        hostname=`hostname`
        ;;
    esac
@


1.8
log
@merge xinit 1.4.0.
@
text
@d285 1
a285 1
    trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM
@


1.8.2.1
log
@Pull up following revision(s) (requested by nia in ticket #1439):

	xsrc/external/mit/xinit/dist/startx.cpp: revision 1.9

Do not attempt to trap SIGKILL
@
text
@d285 1
a285 1
    trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM
@


1.7
log
@Use upstream version for expr fix.
@
text
@d59 1
a59 1
defaultdisplay=":0"
d83 4
d98 1
a98 1
if [ -x XINITDIR/privileged_startx ] ; then
d101 1
a101 1
	XINITDIR/privileged_startx
d112 8
d135 1
a135 1
    [ -e /tmp/.X$d-lock ] || break
d208 1
a208 1
    if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then
d210 1
a210 1
        vtarg="vt$tty_num"
d298 1
a298 1
    XCOMM server man need it. Add them to the '$xserverauthfile' instead.
a340 5
#ifdef macII
Xrepair
screenrestore
#endif

@


1.6
log
@use portable expr(1).  fixes, eg:

	7oclock ~> startx
	expr: syntax error
@
text
@d220 1
a220 1
    if expr "$i" : '^vt[0-9]\+$' > /dev/null; then
@


1.5
log
@merge xfsinfo 1.0.5, xinit 1.3.4, xinput 1.6.1 xkbcomp 1.3.0 and xkbevd 1.1.4.
@
text
@d220 1
a220 1
    if expr match "$i" '^vt[0-9]\+$' > /dev/null; then
@


1.4
log
@merge xfindproxy 1.0.3, xfwp 1.0.3, xhost 1.0.6, xinit 1.3.3,
xload 1.1.2, xlsclients 1.1.3, and xman 1.1.3.
@
text
@d17 1
a17 1
#if defined(__SCO__) || defined(__UNIXWARE__) || defined(__APPLE__)
a35 1
#ifdef __APPLE__
a36 3
#else
oldbindir=/usr/bin/X11
#endif
a49 15
#if defined(__SCO__) || defined(__UNIXWARE__)
XCOMM Set up the XMERGE env var so that dos merge is happy under X

if [ -f /usr/lib/merge/xmergeset.sh ]; then
	. /usr/lib/merge/xmergeset.sh
elif [ -f /usr/lib/merge/console.disp ]; then
	XMERGE=`cat /usr/lib/merge/console.disp`
	export XMERGE
fi

userclientrc=$HOME/.startxrc
sysclientrc=LIBDIR/sys.startxrc
scouserclientrc=$HOME/.xinitrc
scosysclientrc=XINITDIR/xinitrc
#else
a51 1
#endif
d62 1
a128 15
#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

a177 6
#if defined(__SCO__) || defined(__UNIXWARE__)
        elif [ -f "$scouserclientrc" ]; then
            client=$scouserclientrc
        elif [ -f "$scosysclientrc" ]; then
            client=$scosysclientrc
#endif
d191 11
d217 11
a303 8
#if defined(__SCO__) || defined(__UNIXWARE__)
if [ "$REMOTE_SERVER" = "TRUE" ]; then
        exec SHELL_CMD ${client}
else
        XINIT "$client" $clientargs -- "$server" $display $serverargs
fi
#else

a308 2

#endif
@


1.3
log
@merge xcalc 1.0.5, xfd 1.1.1, xfontsel 1.0.5, xfsinfo 1.0.4, xgamma 1.0.5,
xgc 1.0.4, and xhost 1.0.5.
@
text
@d129 3
a131 1
if defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
@


1.2
log
@Add -noretro as default server arg in configuration files where we are
sure the user will get a visible window "soon".
The sole reason we backed out the "retro" change from upstream
was to avoid an empty black screen after manualy starting just "X". With
these preconfigured startup mehtods, this confusion can not happen.
@
text
@d133 5
a145 4
#else
enable_xauth=1
#endif

d204 1
a204 1
    XCOMM if no client arguments either, use rc file instead
d217 2
d220 3
a222 2
        clientargs=$defaultclientargs
    fi
d229 1
a229 1
    XCOMM if no server arguments or display either, use defaults
a230 1
	XCOMM For compatibility reasons, only use xserverrc if there were no server command line arguments
d236 7
d244 3
a246 3
	serverargs=$defaultserverargs
	display=$defaultdisplay
    fi
@


1.1
log
@Initial revision
@
text
@a2 1
XCOMM $Xorg: startx.cpp,v 1.3 2000/08/17 19:54:29 cpqbld Exp $
d8 2
a9 2
XCOMM for .Xresources files and merge them in, startup up a window manager,
XCOMM and pop a clock and serveral xterms.
a12 1
XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $
d24 1
a24 1
XCOMM server theres a pretty good chance you want to bias the Xorg clients
d78 1
a78 1
defaultserverargs=""
d85 4
d90 2
a91 2
if ! defaults read org.x.X11 cache_fonts >& /dev/null ; then
    defaults write org.x.X11 cache_fonts -bool true
d94 2
a95 2
if ! defaults read org.x.X11 no_auth >& /dev/null ; then
    defaults write org.x.X11 no_auth -bool false
d98 2
a99 2
if ! defaults read org.x.X11 nolisten_tcp >& /dev/null ; then
    defaults write org.x.X11 nolisten_tcp -bool true
d103 7
a109 7
if [ x`defaults read org.x.X11 cache_fonts` = x1 ] ; then
    if [ -x /usr/X11/bin/font_cache ] ; then
        /usr/X11/bin/font_cache &
    elif [ -x /usr/X11/bin/font_cache.sh ] ; then
        /usr/X11/bin/font_cache.sh &
    elif [ -x /usr/X11/bin/fc-cache ] ; then
        /usr/X11/bin/fc-cache &
d119 1
a119 1
if [ x`defaults read org.x.X11 no_auth` = x0 ] ; then
d125 1
a125 1
if [ x`defaults read org.x.X11 nolisten_tcp` = x1 ] ; then
d129 8
a136 2
for ((d=0; ; d++)) ; do
    [[ -e /tmp/.X$d-lock ]] || break
d139 1
a144 13

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

d166 1
a166 1
	    if [ x"$clientargs" = x ]; then
d172 1
a172 1
	    if [ x"$serverargs" = x ]; then
d201 2
d205 13
a217 3
	client="$defaultclientargs"
    else
	client=$defaultclient
d228 1
a228 1
	if [ -f $userserverrc ]; then
d230 1
a230 1
	elif [ -f $sysserverrc ]; then
d279 2
a280 2
    trap "rm -f $xserverauthfile" HUP INT QUIT ILL TRAP KILL BUS TERM
    xauth -q -f $xserverauthfile << EOF
d283 4
d288 1
d303 1
a303 1
            XAUTH -q -f $xserverauthfile << EOF
d314 1
a314 1
        XINIT $client $clientargs -- $server $display $serverargs
d317 7
a323 1
XINIT $client $clientargs -- $server $display $serverargs
d325 1
d332 1
a332 1
        rm -f $xserverauthfile
d353 3
@


1.1.1.1
log
@initial import of xinit-1.1.0
@
text
@@


1.1.1.1.2.1
log
@Apply patch (requested by mrg in ticket #958):
Bring over X.Org updates from HEAD.
@
text
@a86 4
if [ "x$X11_PREFS_DOMAIN" = x ] ; then
    X11_PREFS_DOMAIN="org.x.X11"
fi

d88 2
a89 2
if ! defaults read $X11_PREFS_DOMAIN cache_fonts >& /dev/null ; then
    defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
d92 2
a93 2
if ! defaults read $X11_PREFS_DOMAIN no_auth >& /dev/null ; then
    defaults write $X11_PREFS_DOMAIN no_auth -bool false
d96 2
a97 2
if ! defaults read $X11_PREFS_DOMAIN nolisten_tcp >& /dev/null ; then
    defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
d101 7
a107 7
if [ x`defaults read $X11_PREFS_DOMAIN cache_fonts` = x1 ] ; then
    if [ -x $bindir/font_cache ] ; then
        $bindir/font_cache &
    elif [ -x $bindir/font_cache.sh ] ; then
        $bindir/font_cache.sh &
    elif [ -x $bindir/fc-cache ] ; then
        $bindir/fc-cache &
d117 1
a117 1
if [ x`defaults read $X11_PREFS_DOMAIN no_auth` = x0 ] ; then
d123 1
a123 1
if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
a126 4
if defaults read $X11_PREFS_DOMAIN dpi >& /dev/null ; then
    defaultserverargs="$defaultserverargs -dpi `defaults read $X11_PREFS_DOMAIN dpi`"
fi

d136 13
a204 2
    client=$defaultclient

d207 3
a209 13
        if [ -f "$userclientrc" ]; then
            client=$userclientrc
        elif [ -f "$sysclientrc" ]; then
            client=$sysclientrc
#if defined(__SCO__) || defined(__UNIXWARE__)
        elif [ -f "$scouserclientrc" ]; then
            client=$scouserclientrc
        elif [ -f "$scosysclientrc" ]; then
            client=$scosysclientrc
#endif
        fi

        clientargs=$defaultclientargs
d220 1
a220 1
	if [ -f "$userserverrc" ]; then
d222 1
a222 1
	elif [ -f "$sysserverrc" ]; then
d271 2
a272 2
    trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM
    xauth -q -f "$xserverauthfile" << EOF
a274 3
#ifdef __APPLE__
    serverargs=${serverargs}" -auth '"${xserverauthfile}"'"
#else
a275 1
#endif
d290 1
a290 1
            XAUTH -q -f "$xserverauthfile" << EOF
d301 1
a301 1
        XINIT "$client" $clientargs -- "$server" $display $serverargs
d304 1
a304 7

#ifdef __APPLE__
eval XINIT \"$client\" $clientargs -- \"$server\" $display $serverargs
#else
XINIT "$client" $clientargs -- "$server" $display $serverargs
#endif

d312 1
a312 1
        rm -f "$xserverauthfile"
@


1.1.1.2
log
@initial import of xinit-1.1.1
@
text
@a86 4
if [ "x$X11_PREFS_DOMAIN" = x ] ; then
    X11_PREFS_DOMAIN="org.x.X11"
fi

d88 2
a89 2
if ! defaults read $X11_PREFS_DOMAIN cache_fonts >& /dev/null ; then
    defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
d92 2
a93 2
if ! defaults read $X11_PREFS_DOMAIN no_auth >& /dev/null ; then
    defaults write $X11_PREFS_DOMAIN no_auth -bool false
d96 2
a97 2
if ! defaults read $X11_PREFS_DOMAIN nolisten_tcp >& /dev/null ; then
    defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
d101 7
a107 7
if [ x`defaults read $X11_PREFS_DOMAIN cache_fonts` = x1 ] ; then
    if [ -x $bindir/font_cache ] ; then
        $bindir/font_cache &
    elif [ -x $bindir/font_cache.sh ] ; then
        $bindir/font_cache.sh &
    elif [ -x $bindir/fc-cache ] ; then
        $bindir/fc-cache &
d117 1
a117 1
if [ x`defaults read $X11_PREFS_DOMAIN no_auth` = x0 ] ; then
d123 1
a123 1
if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
a126 4
if defaults read $X11_PREFS_DOMAIN dpi >& /dev/null ; then
    defaultserverargs="$defaultserverargs -dpi `defaults read $X11_PREFS_DOMAIN dpi`"
fi

d136 13
a204 2
    client=$defaultclient

d207 3
a209 13
        if [ -f "$userclientrc" ]; then
            client=$userclientrc
        elif [ -f "$sysclientrc" ]; then
            client=$sysclientrc
#if defined(__SCO__) || defined(__UNIXWARE__)
        elif [ -f "$scouserclientrc" ]; then
            client=$scouserclientrc
        elif [ -f "$scosysclientrc" ]; then
            client=$scosysclientrc
#endif
        fi

        clientargs=$defaultclientargs
d220 1
a220 1
	if [ -f "$userserverrc" ]; then
d222 1
a222 1
	elif [ -f "$sysserverrc" ]; then
d271 2
a272 2
    trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM
    xauth -q -f "$xserverauthfile" << EOF
a274 3
#ifdef __APPLE__
    serverargs=${serverargs}" -auth '"${xserverauthfile}"'"
#else
a275 1
#endif
d290 1
a290 1
            XAUTH -q -f "$xserverauthfile" << EOF
d301 1
a301 1
        XINIT "$client" $clientargs -- "$server" $display $serverargs
d304 1
a304 7

#ifdef __APPLE__
eval XINIT \"$client\" $clientargs -- \"$server\" $display $serverargs
#else
XINIT "$client" $clientargs -- "$server" $display $serverargs
#endif

d312 1
a312 1
        rm -f "$xserverauthfile"
@


1.1.1.3
log
@initial import of xinit-1.2.1
@
text
@d3 1
d14 1
d88 1
a88 1
    export X11_PREFS_DOMAIN=LAUNCHD_ID_PREFIX".X11"
d165 1
a165 1
	    if [ x"$client" = x ] && [ x"$clientargs" = x ]; then
d171 1
a171 1
	    if [ x"$server" = x ] && [ x"$serverargs" = x ]; then
d282 2
a283 2
#if defined(__APPLE__) || defined(__CYGWIN__)
    serverargs=${serverargs}" -auth '"${xserverauthfile//\'/\'\\\'\'}"'"
d316 1
a316 1
#if defined(__APPLE__) || defined(__CYGWIN__)
a322 1
retval=$?
a349 3

exit $retval

@


1.1.1.4
log
@initial import of xinit-1.3.0
@
text
@d90 1
a90 1
if ! defaults read $X11_PREFS_DOMAIN cache_fonts > /dev/null 2>&1 ; then
d94 1
a94 1
if ! defaults read $X11_PREFS_DOMAIN no_auth > /dev/null 2>&1 ; then
d98 1
a98 1
if ! defaults read $X11_PREFS_DOMAIN nolisten_tcp > /dev/null 2>&1 ; then
d129 1
a129 1
if defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
d133 2
a134 4
d=0
while true ; do
    [ -e /tmp/.X$d-lock ] || break
    d=$(($d + 1))
a136 1
unset d
d281 1
a281 2
    xserverauthfilequoted=$(echo ${xserverauthfile} | sed "s/'/'\\\\''/g")
    serverargs=${serverargs}" -auth '"${xserverauthfilequoted}"'"
@


1.1.1.5
log
@initial import of xinit-1.3.1
@
text
@d8 2
a9 2
XCOMM for .Xresources files and merge them in, start up a window manager,
XCOMM and pop a clock and several xterms.
d24 1
a24 1
XCOMM server there's a pretty good chance you want to bias the Xorg clients
d86 1
a86 1
    export X11_PREFS_DOMAIN=BUNDLE_ID_PREFIX".X11"
@


1.1.1.6
log
@initial import of xinit-1.3.2
@
text
@a132 5
#else
enable_xauth=1
#endif

XCOMM Automatically determine an unused $DISPLAY
d141 4
d203 1
a203 1
    XCOMM For compatibility reasons, only use startxrc if there were no client command line arguments
d216 2
a220 5
XCOMM if no client arguments, use defaults
if [ x"$clientargs" = x ]; then
    clientargs=$defaultclientargs
fi

d225 1
a225 1
    XCOMM For compatibility reasons, only use xserverrc if there were no server command line arguments
d227 1
d233 3
a238 10
XCOMM if no server arguments, use defaults
if [ x"$serverargs" = x ]; then
    serverargs=$defaultserverargs
fi

XCOMM if no display, use default
if [ x"$display" = x ]; then
    display=$defaultdisplay
fi

@


1.1.1.7
log
@initial import of xinit-1.3.3
@
text
@d129 1
a129 3
XCOMM The second check is the real one.  The first is to hopefully avoid
XCOMM needless syslog spamming.
if defaults read $X11_PREFS_DOMAIN 2> /dev/null | grep -q 'dpi' && defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
@


1.1.1.8
log
@initial import of xinit-1.3.4
@
text
@d17 1
a17 1
#ifdef __APPLE__
d36 1
d38 3
d54 15
d71 1
a81 1
vtarg=""
d148 15
d212 6
a230 11
#ifdef __linux__
    XCOMM When starting the defaultserver start X on the current tty to avoid
    XCOMM the startx session being seen as inactive:
    XCOMM "https://bugzilla.redhat.com/show_bug.cgi?id=806491"
    tty=$(tty)
    if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then
        tty_num=$(echo "$tty" | grep -oE '[0-9]+$')
        vtarg="vt$tty_num"
    fi
#endif

a245 11
XCOMM if no vt is specified add vtarg (which may be empty)
have_vtarg="no"
for i in $serverargs; do
    if expr match "$i" '^vt[0-9]\+$' > /dev/null; then
        have_vtarg="yes"
    fi
done
if [ "$have_vtarg" = "no" ]; then
    serverargs="$serverargs $vtarg"
fi

d322 8
d335 2
@


1.1.1.9
log
@initial import of xinit-1.4.0
@
text
@d59 1
a59 1
defaultdisplay=""
a82 4
if ! defaults read $X11_PREFS_DOMAIN enable_iglx > /dev/null 2>&1 ; then
    defaults write $X11_PREFS_DOMAIN enable_iglx -bool false
fi

d94 1
a94 1
if [ -x __libexecdir__/privileged_startx ] ; then
d97 1
a97 1
	__libexecdir__/privileged_startx
a107 8
else
    defaultserverargs="$defaultserverargs -listen tcp"
fi

if [ x`defaults read $X11_PREFS_DOMAIN enable_iglx` = x1 ] ; then
    defaultserverargs="$defaultserverargs +iglx"
else
    defaultserverargs="$defaultserverargs -iglx"
d123 1
a123 1
    [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] || break
d196 1
a196 1
    if expr "$tty" : '/dev/tty[0-9][0-9]*$' > /dev/null; then
d198 1
a198 1
        vtarg="vt$tty_num -keeptty"
d220 1
a220 1
    if expr "$i" : 'vt[0-9][0-9]*$' > /dev/null; then
d286 1
a286 1
    XCOMM server may need it. Add them to the '$xserverauthfile' instead.
d329 5
@


1.1.1.10
log
@initial import of xinit-1.4.2
@
text
@d5 5
a9 6
XCOMM interface than xinit.  It looks for XINITRC and XSERVERRC environment
XCOMM variables, then user .xinitrc and .xserverrc files, and then system
XCOMM xinitrc and xserverrc files, else lets xinit choose its default.
XCOMM The system xinitrc should probably do things like check for
XCOMM .Xresources files and merge them in, start up a window manager, and
XCOMM pop a clock and several xterms.
d14 1
a50 1
[ -f "${XINITRC}" ] && userclientrc="${XINITRC}"
a53 1
[ -f "${XSERVERRC}" ] && userclientrc="${XSERVERRC}"
d90 1
a90 1
        $bindir/font_cache
d92 1
a92 1
        $bindir/font_cache.sh
d94 1
a94 1
        $bindir/fc-cache
d99 2
a100 2
	XCOMM Don't push this into the background because it can cause
	XCOMM a race to create /tmp/.X11-unix
d117 1
a117 1
    defaultserverargs="$defaultserverargs +iglx +extension GLX"
d209 1
a209 1
        tty_num=${tty#/dev/tty}
d254 12
a265 1
    hostname=`uname -n`
d285 1
a285 1
    trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM
@


1.1.1.11
log
@initial import of xinit-1.4.3
@
text
@a14 11
xinitdir=XINITDIR
xterm=XTERM
xserver=XSERVER
xinit=XINIT
bundle_id_prefix=BUNDLE_ID_PREFIX
xauth=XAUTH
bindir=__bindir__
libexecdir=__libexecdir__
mk_cookie=MK_COOKIE
has_cookie_maker=HAS_COOKIE_MAKER

d17 1
a17 1
if [ "$(uname -s)" = "Darwin" ] ; then
d19 7
a25 7
    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 Note that we put our own bin directory at the front of the path, and
    XCOMM the standard system path at the back, since if you are using the Xorg
    XCOMM server there's a pretty good chance you want to bias the Xorg clients
    XCOMM over the old system's clients.
d27 2
a28 4
    case $PATH in
        *:$bindir | *:$bindir:* | $bindir:*) ;;
        *) PATH=$bindir:$PATH ;;
    esac
d30 4
a33 2
    XCOMM Now the "old" compiled path
    oldbindir=/usr/X11R6/bin
d35 2
a36 6
    if [ -d "$oldbindir" ] ; then
        case $PATH in
            *:$oldbindir | *:$oldbindir:* | $oldbindir:*) ;;
            *) PATH=$PATH:$oldbindir ;;
        esac
    fi
d38 5
a42 3
    XCOMM Bourne shell does not automatically export modified environment variables
    XCOMM so export the new PATH just in case the user changes the shell
    export PATH
d45 5
d55 4
a58 4
[ -f "${XSERVERRC}" ] && userserverrc="${XSERVERRC}"
sysserverrc=$xinitdir/xserverrc
defaultclient=$xterm
defaultserver=$xserver
d66 1
d68 3
a70 1
if [ "$(uname -s)" = "Darwin" ] ; then
d72 4
a75 3
    if [ "$X11_PREFS_DOMAIN" = "" ] ; then
        export X11_PREFS_DOMAIN=$bundle_id_prefix".X11"
    fi
d77 3
a79 4
    XCOMM Initialize defaults (this will cut down on "safe" error messages)
    if ! defaults read $X11_PREFS_DOMAIN cache_fonts > /dev/null 2>&1 ; then
        defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
    fi
d81 3
a83 3
    if ! defaults read $X11_PREFS_DOMAIN no_auth > /dev/null 2>&1 ; then
        defaults write $X11_PREFS_DOMAIN no_auth -bool false
    fi
d85 3
a87 3
    if ! defaults read $X11_PREFS_DOMAIN nolisten_tcp > /dev/null 2>&1 ; then
        defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
    fi
d89 8
a96 13
    if ! defaults read $X11_PREFS_DOMAIN enable_iglx > /dev/null 2>&1 ; then
        defaults write $X11_PREFS_DOMAIN enable_iglx -bool false
    fi

    XCOMM First, start caching fonts
    if [ "$(defaults read $X11_PREFS_DOMAIN cache_fonts)" = 1 ] ; then
        if [ -x $bindir/font_cache ] ; then
            $bindir/font_cache
        elif [ -x $bindir/font_cache.sh ] ; then
            $bindir/font_cache.sh
        elif [ -x $bindir/fc-cache ] ; then
            $bindir/fc-cache
        fi
d98 1
d100 1
a100 1
    if [ -x $libexecdir/privileged_startx ] ; then
d103 2
a104 2
	$libexecdir/privileged_startx
    fi
d106 5
a110 5
    if [ "$(defaults read $X11_PREFS_DOMAIN no_auth)" = 0 ] ; then
        enable_xauth=1
    else
        enable_xauth=0
    fi
d112 5
a116 5
    if [ "$(defaults read $X11_PREFS_DOMAIN nolisten_tcp)" = 1 ] ; then
        defaultserverargs="$defaultserverargs -nolisten tcp"
    else
        defaultserverargs="$defaultserverargs -listen tcp"
    fi
d118 5
a122 5
    if [ "$(defaults read $X11_PREFS_DOMAIN enable_iglx)" = 1 ] ; then
        defaultserverargs="$defaultserverargs +iglx +extension GLX"
    else
        defaultserverargs="$defaultserverargs -iglx"
    fi
d124 5
a128 5
    XCOMM The second check is the real one.  The first is to hopefully avoid
    XCOMM needless syslog spamming.
    if defaults read $X11_PREFS_DOMAIN 2> /dev/null | grep -q 'dpi' && defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
        defaultserverargs="$defaultserverargs -dpi $(defaults read $X11_PREFS_DOMAIN dpi)"
    fi
d130 3
a132 3
else
    enable_xauth=1
fi
d144 1
a144 1
while [ "$1" != "" ]; do
d149 1
a149 1
	    if [ "$client" = "" ] && [ "$clientargs" = "" ]; then
d155 1
a155 1
	    if [ "$server" = "" ] && [ "$serverargs" = "" ]; then
d170 1
a170 1
	    if [ "$serverargs" = "" ] && @@@@
d183 1
a183 1
if [ "$client" = "" ]; then
d187 1
a187 1
    if [ "$clientargs" = "" ]; then
d197 1
a197 1
if [ "$clientargs" = "" ]; then
d202 1
a202 1
if [ "$server" = "" ]; then
d205 1
a205 1
if [ "$(uname -s)" = "Linux" ] ; then
d214 1
a214 1
fi
d217 1
a217 1
    if [ "$serverargs" = "" ] && [ "$display" = "" ]; then
d227 1
a227 1
if [ "$serverargs" = "" ]; then
d243 1
a243 1
if [ "$display" = "" ]; then
d247 2
a248 2
if [ "$enable_xauth" = 1 ] ; then
    if [ "$XAUTHORITY" = "" ]; then
d256 1
a256 1
    hostname="$(uname -n)"
d259 5
a263 2
    if [ -n "$has_cookie_maker" ] && [ -n "$mk_cookie" ] ; then
        mcookie=$($mk_cookie)
d265 1
a265 5
        if [ -r /dev/urandom ]; then
            mcookie=$(dd if=dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\")
        else
            mcookie=$(dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\")
        fi
d267 2
a268 1
    if [ "$mcookie" = "" ]; then
d280 6
a285 10

    case "$(uname -s)" in
    CYGWIN*|Darwin)
        xserverauthfilequoted=$(echo ${xserverauthfile} | sed "s/'/'\\\\''/g")
        serverargs=${serverargs}" -auth '"${xserverauthfilequoted}"'"
        ;;
    *)
        serverargs=${serverargs}" -auth "${xserverauthfile}
        ;;
    esac
d291 2
a292 2
        authcookie=$(xauth list "$displayname" @@@@
        | sed -n 's/.*'"$displayname"'[[:space:]*].*[[:space:]*]//p' 2>/dev/null);
d294 1
a294 1
            $xauth -q << EOF
d300 1
a300 1
            $xauth -q -f "$xserverauthfile" << EOF
d307 5
a311 8
case "$(uname -s)" in
CYGWIN_NT*|Darwin)
    eval $xinit \"$client\" $clientargs -- \"$server\" $display $serverargs
    ;;
*)
    $xinit "$client" $clientargs -- "$server" $display $serverargs
    ;;
esac
d314 3
a316 3
if [ "$enable_xauth" = 1 ] ; then
    if [ "$removelist" != "" ]; then
        $xauth remove $removelist
d318 1
a318 1
    if [ "$xserverauthfile" != "" ]; then
d323 12
a334 10
XCOMM various machines need special cleaning up
if [ "$(uname -s)" = "Linux" ]; then
    if command -v deallocvt > /dev/null 2>&1; then
        deallocvt
    fi
fi

if [ "$(uname -s)" = "SunOS" ]; then
    kbd_mode -a
fi
d337 1
@


1.1.1.5.2.1
log
@Pull up following revision(s) (requested by martin in ticket #86):
	external/mit/xinit/dist/startx.cpp: revision 1.2
	external/mit/xdm/dist/config/Xservers.ws.cpp: revision 1.2
Add -noretro as default server arg in configuration files where we are
sure the user will get a visible window "soon".
The sole reason we backed out the "retro" change from upstream
was to avoid an empty black screen after manualy starting just "X". With
these preconfigured startup mehtods, this confusion can not happen.
@
text
@d78 1
a78 1
defaultserverargs="-noretro"
@


