date and time created 88/06/29 21:19:25 by bostic
[unix-history] / usr / src / usr.bin / window / startup.c
CommitLineData
60de5df9 1/*
46e9ea25
KB
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
60de5df9
EW
11 */
12
46e9ea25
KB
13#ifndef lint
14static char sccsid[] = "@(#)startup.c 3.20 (Berkeley) %G%";
15#endif /* not lint */
16
34ac147f 17#include "defs.h"
6e1c2156
EW
18#include "value.h"
19#include "var.h"
0e64e422 20#include "char.h"
7c38ad4d 21#include "local.h"
34ac147f 22
34ac147f
EW
23doconfig()
24{
25 char buf[100];
26 char *home;
7c38ad4d 27 static char runcom[] = RUNCOM;
34ac147f
EW
28
29 if ((home = getenv("HOME")) == 0)
f828d428 30 home = ".";
a2061e43 31 sprintf(buf, "%.*s/%s",
f828d428 32 (sizeof buf - sizeof runcom) / sizeof (char) - 1,
a2061e43
KB
33 home, runcom);
34 return dosource(buf);
34ac147f
EW
35}
36
37/*
e1b16bc3 38 * The default is two windows of equal size.
34ac147f
EW
39 */
40dodefault()
41{
42 struct ww *w;
3acb719c 43 register r = wwnrow / 2 - 1;
34ac147f 44
63b87416 45 if (openwin(1, r + 2, 0, wwnrow - r - 2, wwncol, nbufline,
f828d428 46 (char *) 0, 1, 1, shellfile, shell) == 0)
e1b16bc3 47 return;
63b87416 48 if ((w = openwin(0, 1, 0, r, wwncol, nbufline,
a9e3b681
EW
49 (char *) 0, 1, 1, shellfile, shell)) == 0)
50 return;
b1189050 51 wwprintf(w, "Escape character is %s.\r\n", unctrl(escapec));
34ac147f 52}
6e1c2156
EW
53
54setvars()
55{
0e64e422 56 /* try to use a random ordering to balance the tree */
6e1c2156 57 (void) var_setnum("nrow", wwnrow);
78be6843 58 (void) var_setnum("ncol", wwncol);
6e1c2156
EW
59 (void) var_setnum("baud", wwbaud);
60 (void) var_setnum("m_rev", WWM_REV);
61 (void) var_setnum("m_blk", WWM_BLK);
62 (void) var_setnum("m_ul", WWM_UL);
78be6843 63 (void) var_setnum("m_grp", WWM_GRP);
a6833679
EW
64 (void) var_setnum("m_dim", WWM_DIM);
65 (void) var_setnum("m_usr", WWM_USR);
6e1c2156 66 (void) var_setstr("term", wwterm);
0e64e422 67 (void) var_setnum("modes", wwavailmodes);
6e1c2156 68}