install approved copyright notice
[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
5e8b0e60
KB
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
60de5df9
EW
16 */
17
46e9ea25 18#ifndef lint
5e8b0e60 19static char sccsid[] = "@(#)startup.c 3.21 (Berkeley) %G%";
46e9ea25
KB
20#endif /* not lint */
21
34ac147f 22#include "defs.h"
6e1c2156
EW
23#include "value.h"
24#include "var.h"
0e64e422 25#include "char.h"
7c38ad4d 26#include "local.h"
34ac147f 27
34ac147f
EW
28doconfig()
29{
30 char buf[100];
31 char *home;
7c38ad4d 32 static char runcom[] = RUNCOM;
34ac147f
EW
33
34 if ((home = getenv("HOME")) == 0)
f828d428 35 home = ".";
a2061e43 36 sprintf(buf, "%.*s/%s",
f828d428 37 (sizeof buf - sizeof runcom) / sizeof (char) - 1,
a2061e43
KB
38 home, runcom);
39 return dosource(buf);
34ac147f
EW
40}
41
42/*
e1b16bc3 43 * The default is two windows of equal size.
34ac147f
EW
44 */
45dodefault()
46{
47 struct ww *w;
3acb719c 48 register r = wwnrow / 2 - 1;
34ac147f 49
63b87416 50 if (openwin(1, r + 2, 0, wwnrow - r - 2, wwncol, nbufline,
f828d428 51 (char *) 0, 1, 1, shellfile, shell) == 0)
e1b16bc3 52 return;
63b87416 53 if ((w = openwin(0, 1, 0, r, wwncol, nbufline,
a9e3b681
EW
54 (char *) 0, 1, 1, shellfile, shell)) == 0)
55 return;
b1189050 56 wwprintf(w, "Escape character is %s.\r\n", unctrl(escapec));
34ac147f 57}
6e1c2156
EW
58
59setvars()
60{
0e64e422 61 /* try to use a random ordering to balance the tree */
6e1c2156 62 (void) var_setnum("nrow", wwnrow);
78be6843 63 (void) var_setnum("ncol", wwncol);
6e1c2156
EW
64 (void) var_setnum("baud", wwbaud);
65 (void) var_setnum("m_rev", WWM_REV);
66 (void) var_setnum("m_blk", WWM_BLK);
67 (void) var_setnum("m_ul", WWM_UL);
78be6843 68 (void) var_setnum("m_grp", WWM_GRP);
a6833679
EW
69 (void) var_setnum("m_dim", WWM_DIM);
70 (void) var_setnum("m_usr", WWM_USR);
6e1c2156 71 (void) var_setstr("term", wwterm);
0e64e422 72 (void) var_setnum("modes", wwavailmodes);
6e1c2156 73}