Commit | Line | Data |
---|---|---|
57f965d5 | 1 | #ifndef lint |
a4c3bba5 | 2 | static char *sccsid = "@(#)cmd3.c 3.3 83/08/22"; |
57f965d5 EW |
3 | #endif |
4 | ||
5 | #include "defs.h" | |
6 | ||
85af59e4 | 7 | c_close(w) |
c417b691 | 8 | register struct ww *w; |
57f965d5 | 9 | { |
c417b691 | 10 | char didit = 0; |
85af59e4 | 11 | register i; |
57f965d5 | 12 | |
c0893e4e | 13 | if (w != 0) { |
85af59e4 | 14 | closewin(w); |
c417b691 | 15 | didit++; |
c0893e4e | 16 | } else { |
85af59e4 EW |
17 | for (i = 0; i < NWINDOW; i++) { |
18 | if ((w = window[i]) == 0) | |
c0893e4e | 19 | continue; |
a4c3bba5 | 20 | closewin(w); |
85af59e4 | 21 | didit++; |
57f965d5 | 22 | } |
57f965d5 EW |
23 | } |
24 | if (selwin == 0) { | |
2b0da92e | 25 | for (i = 0; i < NWINDOW && window[i] == 0; i++) |
57f965d5 | 26 | ; |
85af59e4 EW |
27 | if (i < NWINDOW) |
28 | setselwin(window[i]); | |
57f965d5 | 29 | } |
c417b691 EW |
30 | if (didit) |
31 | reframe(); | |
57f965d5 | 32 | } |
0de7ca29 | 33 | |
85af59e4 EW |
34 | closewin(w) |
35 | register struct ww *w; | |
0de7ca29 | 36 | { |
85af59e4 EW |
37 | if (w == selwin) |
38 | setselwin((struct ww *)0); | |
39 | if (w->ww_id >= 0 && w->ww_id < NWINDOW) | |
40 | window[w->ww_id] = 0; | |
41 | if (w->ww_label) | |
42 | free(w->ww_label); | |
43 | wwdelete(w); | |
44 | wwclose(w); | |
0de7ca29 EW |
45 | } |
46 | ||
47 | setescape(esc) | |
48 | register char *esc; | |
49 | { | |
50 | if (*esc == '^') { | |
51 | if (esc[1] != 0) | |
52 | escapec = esc[1] & 0x1f; | |
53 | else | |
54 | escapec = '^'; | |
55 | } else | |
56 | escapec = *esc; | |
57 | } | |
c0893e4e | 58 | |
c0893e4e EW |
59 | setlabel(w, label) |
60 | register struct ww *w; | |
61 | char *label; | |
62 | { | |
bc326b22 EW |
63 | char *malloc(); |
64 | ||
c0893e4e EW |
65 | if (w->ww_label != 0) |
66 | free(w->ww_label); | |
85af59e4 EW |
67 | if ((w->ww_label = malloc((unsigned)strlen(label) + 1)) == 0) |
68 | return -1; | |
69 | (void) strcpy(w->ww_label, label); | |
70 | return 0; | |
c0893e4e | 71 | } |