| 1 | #ifndef lint |
| 2 | static char *sccsid = "@(#)startup.c 3.12 84/04/16"; |
| 3 | #endif |
| 4 | |
| 5 | #include "defs.h" |
| 6 | #include "value.h" |
| 7 | #include "var.h" |
| 8 | #include "char.h" |
| 9 | #include "local.h" |
| 10 | |
| 11 | doconfig() |
| 12 | { |
| 13 | char buf[100]; |
| 14 | char *home; |
| 15 | static char runcom[] = RUNCOM; |
| 16 | |
| 17 | if ((home = getenv("HOME")) == 0) |
| 18 | home = "."; |
| 19 | return dosource(sprintf(buf, "%.*s/.windrc", |
| 20 | (sizeof buf - sizeof runcom) / sizeof (char) - 1, |
| 21 | home, runcom)); |
| 22 | } |
| 23 | |
| 24 | /* |
| 25 | * The default is two windows of equal sizes. |
| 26 | */ |
| 27 | dodefault() |
| 28 | { |
| 29 | struct ww *w; |
| 30 | register r = wwnrow / 2 - 1; |
| 31 | |
| 32 | if ((w = openwin(-1, 1, 0, r, wwncol, nbufline, |
| 33 | (char *) 0, 1, 1, shellfile, shell)) == 0) |
| 34 | goto bad; |
| 35 | if (openwin(-1, r + 2, 0, wwnrow - r - 2, wwncol, nbufline, |
| 36 | (char *) 0, 1, 1, shellfile, shell) == 0) |
| 37 | goto bad; |
| 38 | wwprintf(w, "Escape character is %s.\r\n", unctrl(escapec)); |
| 39 | setselwin(w); |
| 40 | return; |
| 41 | bad: |
| 42 | error("Can't open default windows."); |
| 43 | } |
| 44 | |
| 45 | setvars() |
| 46 | { |
| 47 | /* try to use a random ordering to balance the tree */ |
| 48 | (void) var_setnum("nrow", wwnrow); |
| 49 | (void) var_setnum("ncol", wwncol); |
| 50 | (void) var_setnum("baud", wwbaud); |
| 51 | (void) var_setnum("m_rev", WWM_REV); |
| 52 | (void) var_setnum("m_blk", WWM_BLK); |
| 53 | (void) var_setnum("m_ul", WWM_UL); |
| 54 | (void) var_setnum("m_grp", WWM_GRP); |
| 55 | (void) var_setstr("term", wwterm); |
| 56 | (void) var_setnum("modes", wwavailmodes); |
| 57 | } |