summaryrefslogtreecommitdiff
path: root/startx.cmd
blob: 4b4e712273973c8783a904927d38a462fbc069e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* OS/2 REXX */
/* $XFree86: xc/programs/xinit/startx.cmd,v 3.4 2003/11/12 00:10:31 dawes Exp $
 * 
 * This is just a sample implementation of a slightly less primitive 
 * interface than xinit.  It looks for user xinitrc.cmd and xservrc.cmd
 * files, then system xinitrc.cmd and xservrc.cmd files, else lets xinit choose
 * its default.  The system xinitrc should probably do things like check
 * for Xresources files and merge them in, startup up a window manager,
 * and pop a clock and serveral xterms.
 *
 * Site administrators are STRONGLY urged to write nicer versions.
 */
'@echo off'
ADDRESS CMD
env = 'OS2ENVIRONMENT'
x11root = VALUE('X11ROOT',,env)
IF x11root = '' THEN DO
	SAY "The environment variable X11ROOT is not set. XFree86/OS2 won't run without it."
	EXIT
END

home = VALUE('HOME',,env)
IF home = '' THEN home = x11root
os_shell = VALUE('X11SHELL',,env)
IF os_shell = '' THEN os_shell = VALUE('SHELL',,env)
IF os_shell = '' THEN os_shell = VALUE('OS2_SHELL',,env)
IF os_shell = '' THEN DO
	SAY "There is no command interpreter in OS2_SHELL ???"
	EXIT
END

userclientrc = home'\xinitrc.cmd'
userserverrc = home'\xservrc.cmd'
sysclientrc  = x11root'\usr\X11R6\lib\X11\xinit\xinitrc.cmd'
sysserverrc  = x11root'\usr\X11R6\lib\X11\xinit\xservrc.cmd'
clientargs   = ''
serverargs   = ''

IF exists(userclientrc) THEN
	clientargs = userclientrc
ELSE 
IF exists(sysclientrc) THEN
	clientargs = sysclientrc

IF exists(userserverrc) THEN
	serverargs = userserverrc
ELSE 
IF exists(sysserverrc) THEN
	serverargs = sysserverrc

whoseargs = "client"
PARSE ARG all

DO i=1 TO WORDS(all)
	cur = WORD(all,i)
	IF \(FILESPEC('DRIVE',cur) = '') THEN DO
		IF whoseargs = "client" THEN
			clientargs = cur
		ELSE
			serverargs = cur
	END
	ELSE
	IF cur = "--" THEN 
		whoseargs = "server"
	ELSE 
	IF whoseargs = "client" THEN
		clientargs = clientargs' 'cur
	ELSE
		serverargs = serverargs' 'cur
END

xinit = x11root'\usr\X11R6\bin\xinit'
xinit os_shell' /c 'clientargs' -- 'serverargs

RETURN

exists:
	IF STREAM(arg(1), 'C', 'QUERY EXISTS') = '' THEN
		RETURN 0
	ELSE
		RETURN 1