xref: /386bsd/usr/X386/bin/startx (revision a2142627)
1#!/bin/sh
2
3# $XFree86: mit/clients/xinit/startx.cpp,v 2.0 1993/10/13 15:49:15 dawes Exp $
4# $XConsortium: startx.cpp,v 1.4 91/08/22 11:41:29 rws Exp $
5#
6# This is just a sample implementation of a slightly less primitive
7# interface than xinit.  It looks for user .xinitrc and .xserverrc
8# files, then system xinitrc and xserverrc files, else lets xinit choose
9# its default.  The system xinitrc should probably do things like check
10# for .Xresources files and merge them in, startup up a window manager,
11# and pop a clock and serveral xterms.
12#
13# Site administrators are STRONGLY urged to write nicer versions.
14#
15
16userclientrc=$HOME/.xinitrc
17userserverrc=$HOME/.xserverrc
18if [ x"$XWINHOME" != x ]; then
19    if [ x"$XWINHOME" = x/usr ]; then
20        BIN_DIR=/usr/bin/X11
21    else
22        BIN_DIR=$XWINHOME/bin
23    fi
24    XINIT_DIR=$XWINHOME/lib/X11/xinit
25else
26    BIN_DIR=/usr/X386/bin
27    XINIT_DIR=/usr/X386/lib/X11/xinit
28fi
29sysclientrc=$XINIT_DIR/xinitrc
30sysserverrc=$XINIT_DIR/xserverrc
31clientargs=""
32serverargs=""
33
34if [ -f $userclientrc ]; then
35    clientargs=$userclientrc
36else if [ -f $sysclientrc ]; then
37    clientargs=$sysclientrc
38fi
39fi
40
41if [ -f $userserverrc ]; then
42    serverargs=$userserverrc
43else if [ -f $sysserverrc ]; then
44    serverargs=$sysserverrc
45fi
46fi
47
48whoseargs="client"
49have_server=0
50while [ "x$1" != "x" ]; do
51    case "$1" in
52	/''*|\.*)	if [ "$whoseargs" = "client" ]; then
53		    clientargs="$1"
54		else
55		    serverargs="$1"
56		    have_server=1
57		fi ;;
58	--)	whoseargs="server" ;;
59	*)	if [ "$whoseargs" = "client" ]; then
60		    clientargs="$clientargs $1"
61		else
62		    if [ "$have_server" = 0 ]; then
63			if [ -x $BIN_DIR/"$1" ]; then
64			    serverargs=$BIN_DIR/"$1"
65			    have_server=1
66			else
67			    serverargs="$serverargs $1"
68			fi
69		    else
70		        serverargs="$serverargs $1"
71		    fi
72		fi ;;
73    esac
74    shift
75done
76
77xinit $clientargs -- $serverargs
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92kbd_mode -a
93
94