| 1 | #ifndef lint |
| 2 | static char sccsid[] = "@(#)cmd3.c 3.13 %G%"; |
| 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 "string.h" |
| 13 | |
| 14 | c_close(w) |
| 15 | register struct ww *w; |
| 16 | { |
| 17 | char didit = 0; |
| 18 | register i; |
| 19 | |
| 20 | if (w != 0) { |
| 21 | closewin(w); |
| 22 | didit++; |
| 23 | } else { |
| 24 | for (i = 0; i < NWINDOW; i++) { |
| 25 | if ((w = window[i]) == 0) |
| 26 | continue; |
| 27 | closewin(w); |
| 28 | didit++; |
| 29 | } |
| 30 | } |
| 31 | if (selwin == 0) { |
| 32 | if (lastselwin != 0) |
| 33 | setselwin(lastselwin); |
| 34 | else { |
| 35 | for (i = 0; i < NWINDOW && window[i] == 0; i++) |
| 36 | ; |
| 37 | if (i < NWINDOW) |
| 38 | setselwin(window[i]); |
| 39 | } |
| 40 | } |
| 41 | if (didit) |
| 42 | reframe(); |
| 43 | } |
| 44 | |
| 45 | setescape(esc) |
| 46 | register char *esc; |
| 47 | { |
| 48 | if (*esc == '^') { |
| 49 | if (esc[1] != 0) |
| 50 | escapec = esc[1] & 0x1f; |
| 51 | else |
| 52 | escapec = '^'; |
| 53 | } else |
| 54 | escapec = *esc; |
| 55 | } |
| 56 | |
| 57 | setlabel(w, label) |
| 58 | register struct ww *w; |
| 59 | char *label; |
| 60 | { |
| 61 | if (w->ww_label != 0) |
| 62 | str_free(w->ww_label); |
| 63 | if ((w->ww_label = str_cpy(label)) == 0) |
| 64 | return -1; |
| 65 | return 0; |
| 66 | } |