xref: /original-bsd/usr.bin/window/startup.c (revision a910c8b7)
1 #ifndef lint
2 static char sccsid[] = "@(#)startup.c	3.17 04/24/85";
3 #endif
4 
5 /*
6  * Copyright (c) 1983 Regents of the University of California,
7  * All rights reserved.  Redistribution permitted subject to
8  * the terms of the Berkeley Software License Agreement.
9  */
10 
11 #include "defs.h"
12 #include "value.h"
13 #include "var.h"
14 #include "char.h"
15 #include "local.h"
16 
17 doconfig()
18 {
19 	char buf[100];
20 	char *home;
21 	static char runcom[] = RUNCOM;
22 
23 	if ((home = getenv("HOME")) == 0)
24 		home = ".";
25 	return dosource(sprintf(buf, "%.*s/%s",
26 		(sizeof buf - sizeof runcom) / sizeof (char) - 1,
27 		home, runcom));
28 }
29 
30 /*
31  * The default is two windows of equal size.
32  */
33 dodefault()
34 {
35 	struct ww *w;
36 	register r = wwnrow / 2 - 1;
37 
38 	if (openwin(1, r + 2, 0, wwnrow - r - 2, wwncol, nbufline,
39 				(char *) 0, 1, 1, shellfile, shell) == 0)
40 		return;
41 	if ((w = openwin(0, 1, 0, r, wwncol, nbufline,
42 				(char *) 0, 1, 1, shellfile, shell)) == 0)
43 		return;
44 	wwprintf(w, "Escape character is %s.\r\n", unctrl(escapec));
45 }
46 
47 setvars()
48 {
49 	/* try to use a random ordering to balance the tree */
50 	(void) var_setnum("nrow", wwnrow);
51 	(void) var_setnum("ncol", wwncol);
52 	(void) var_setnum("baud", wwbaud);
53 	(void) var_setnum("m_rev", WWM_REV);
54 	(void) var_setnum("m_blk", WWM_BLK);
55 	(void) var_setnum("m_ul", WWM_UL);
56 	(void) var_setnum("m_grp", WWM_GRP);
57 	(void) var_setstr("term", wwterm);
58 	(void) var_setnum("modes", wwavailmodes);
59 }
60