only clean out gs when last window goes
[nvi.git] / cl / cl_funcs.c
blobc8fee10426840baadfa02cb485bd17df8ac69861
1 /*-
2 * Copyright (c) 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
8 */
10 #include "config.h"
12 #ifndef lint
13 static const char sccsid[] = "$Id: cl_funcs.c,v 10.58 2000/06/25 17:34:36 skimo Exp $ (Berkeley) $Date: 2000/06/25 17:34:36 $";
14 #endif /* not lint */
16 #include <sys/types.h>
17 #include <sys/queue.h>
18 #include <sys/time.h>
20 #include <bitstring.h>
21 #include <ctype.h>
22 #include <curses.h>
23 #include <signal.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <termios.h>
28 #include <unistd.h>
30 #include "../common/common.h"
31 #include "../vi/vi.h"
32 #include "cl.h"
34 static void cl_rdiv __P((SCR *));
37 * cl_addstr --
38 * Add len bytes from the string at the cursor, advancing the cursor.
40 * PUBLIC: int cl_addstr __P((SCR *, const char *, size_t));
42 int
43 cl_addstr(sp, str, len)
44 SCR *sp;
45 const char *str;
46 size_t len;
48 CL_PRIVATE *clp;
49 WINDOW *win;
50 size_t y, x;
51 int iv;
53 clp = CLP(sp);
54 win = CLSP(sp) ? CLSP(sp) : stdscr;
57 * If ex isn't in control, it's the last line of the screen and
58 * it's a split screen, use inverse video.
60 iv = 0;
61 getyx(win, y, x);
62 if (!F_ISSET(sp, SC_SCR_EXWROTE) &&
63 y == RLNO(sp, LASTLINE(sp)) && IS_SPLIT(sp)) {
64 iv = 1;
65 (void)wstandout(win);
68 if (waddnstr(win, str, len) == ERR)
69 return (1);
71 if (iv)
72 (void)wstandend(win);
73 return (0);
77 * cl_attr --
78 * Toggle a screen attribute on/off.
80 * PUBLIC: int cl_attr __P((SCR *, scr_attr_t, int));
82 int
83 cl_attr(sp, attribute, on)
84 SCR *sp;
85 scr_attr_t attribute;
86 int on;
88 CL_PRIVATE *clp;
89 WINDOW *win;
91 clp = CLP(sp);
92 win = CLSP(sp) ? CLSP(sp) : stdscr;
94 switch (attribute) {
95 case SA_ALTERNATE:
97 * !!!
98 * There's a major layering violation here. The problem is that the
99 * X11 xterm screen has what's known as an "alternate" screen. Some
100 * xterm termcap/terminfo entries include sequences to switch to/from
101 * that alternate screen as part of the ti/te (smcup/rmcup) strings.
102 * Vi runs in the alternate screen, so that you are returned to the
103 * same screen contents on exit from vi that you had when you entered
104 * vi. Further, when you run :shell, or :!date or similar ex commands,
105 * you also see the original screen contents. This wasn't deliberate
106 * on vi's part, it's just that it historically sent terminal init/end
107 * sequences at those times, and the addition of the alternate screen
108 * sequences to the strings changed the behavior of vi. The problem
109 * caused by this is that we don't want to switch back to the alternate
110 * screen while getting a new command from the user, when the user is
111 * continuing to enter ex commands, e.g.:
113 * :!date <<< switch to original screen
114 * [Hit return to continue] <<< prompt user to continue
115 * :command <<< get command from user
117 * Note that the :command input is a true vi input mode, e.g., input
118 * maps and abbreviations are being done. So, we need to be able to
119 * switch back into the vi screen mode, without flashing the screen.
121 * To make matters worse, the curses initscr() and endwin() calls will
122 * do this automatically -- so, this attribute isn't as controlled by
123 * the higher level screen as closely as one might like.
125 if (on) {
126 if (clp->ti_te != TI_SENT) {
127 clp->ti_te = TI_SENT;
128 if (clp->smcup == NULL)
129 (void)cl_getcap(sp, "smcup", &clp->smcup);
130 if (clp->smcup != NULL)
131 (void)tputs(clp->smcup, 1, cl_putchar);
133 } else
134 if (clp->ti_te != TE_SENT) {
135 clp->ti_te = TE_SENT;
136 if (clp->rmcup == NULL)
137 (void)cl_getcap(sp, "rmcup", &clp->rmcup);
138 if (clp->rmcup != NULL)
139 (void)tputs(clp->rmcup, 1, cl_putchar);
140 (void)fflush(stdout);
142 (void)fflush(stdout);
143 break;
144 case SA_INVERSE:
145 if (F_ISSET(sp, SC_EX | SC_SCR_EXWROTE)) {
146 if (clp->smso == NULL)
147 return (1);
148 if (on)
149 (void)tputs(clp->smso, 1, cl_putchar);
150 else
151 (void)tputs(clp->rmso, 1, cl_putchar);
152 (void)fflush(stdout);
153 } else {
154 if (on)
155 (void)wstandout(win);
156 else
157 (void)wstandend(win);
159 break;
160 default:
161 abort();
163 return (0);
167 * cl_baud --
168 * Return the baud rate.
170 * PUBLIC: int cl_baud __P((SCR *, u_long *));
173 cl_baud(sp, ratep)
174 SCR *sp;
175 u_long *ratep;
177 CL_PRIVATE *clp;
180 * XXX
181 * There's no portable way to get a "baud rate" -- cfgetospeed(3)
182 * returns the value associated with some #define, which we may
183 * never have heard of, or which may be a purely local speed. Vi
184 * only cares if it's SLOW (w300), slow (w1200) or fast (w9600).
185 * Try and detect the slow ones, and default to fast.
187 clp = CLP(sp);
188 switch (cfgetospeed(&clp->orig)) {
189 case B50:
190 case B75:
191 case B110:
192 case B134:
193 case B150:
194 case B200:
195 case B300:
196 case B600:
197 *ratep = 600;
198 break;
199 case B1200:
200 *ratep = 1200;
201 break;
202 default:
203 *ratep = 9600;
204 break;
206 return (0);
210 * cl_bell --
211 * Ring the bell/flash the screen.
213 * PUBLIC: int cl_bell __P((SCR *));
216 cl_bell(sp)
217 SCR *sp;
219 if (F_ISSET(sp, SC_EX | SC_SCR_EXWROTE | SC_SCR_EX))
220 (void)write(STDOUT_FILENO, "\07", 1); /* \a */
221 else {
223 * Vi has an edit option which determines if the terminal
224 * should be beeped or the screen flashed.
226 if (O_ISSET(sp, O_FLASH))
227 (void)flash();
228 else
229 (void)beep();
231 return (0);
235 * cl_clrtoeol --
236 * Clear from the current cursor to the end of the line.
238 * PUBLIC: int cl_clrtoeol __P((SCR *));
241 cl_clrtoeol(sp)
242 SCR *sp;
244 WINDOW *win;
245 size_t spcnt, y, x;
247 win = CLSP(sp) ? CLSP(sp) : stdscr;
249 #if 0
250 if (IS_VSPLIT(sp)) {
251 /* The cursor must be returned to its original position. */
252 getyx(win, y, x);
253 for (spcnt = (sp->coff + sp->cols) - x; spcnt > 0; --spcnt)
254 (void)waddch(win, ' ');
255 (void)wmove(win, y, x);
256 return (0);
257 } else
258 #endif
259 return (wclrtoeol(win) == ERR);
263 * cl_cursor --
264 * Return the current cursor position.
266 * PUBLIC: int cl_cursor __P((SCR *, size_t *, size_t *));
269 cl_cursor(sp, yp, xp)
270 SCR *sp;
271 size_t *yp, *xp;
273 WINDOW *win;
274 win = CLSP(sp) ? CLSP(sp) : stdscr;
276 * The curses screen support splits a single underlying curses screen
277 * into multiple screens to support split screen semantics. For this
278 * reason the returned value must be adjusted to be relative to the
279 * current screen, and not absolute. Screens that implement the split
280 * using physically distinct screens won't need this hack.
282 getyx(win, *yp, *xp);
284 *yp -= sp->roff;
285 *xp -= sp->coff;
287 return (0);
291 * cl_deleteln --
292 * Delete the current line, scrolling all lines below it.
294 * PUBLIC: int cl_deleteln __P((SCR *));
297 cl_deleteln(sp)
298 SCR *sp;
300 CHAR_T ch;
301 CL_PRIVATE *clp;
302 WINDOW *win;
303 size_t col, lno, spcnt, y, x;
305 clp = CLP(sp);
306 win = CLSP(sp) ? CLSP(sp) : stdscr;
309 * This clause is required because the curses screen uses reverse
310 * video to delimit split screens. If the screen does not do this,
311 * this code won't be necessary.
313 * If the bottom line was in reverse video, rewrite it in normal
314 * video before it's scrolled.
316 * Check for the existence of a chgat function; XSI requires it, but
317 * historic implementations of System V curses don't. If it's not
318 * a #define, we'll fall back to doing it by hand, which is slow but
319 * acceptable.
321 * By hand means walking through the line, retrieving and rewriting
322 * each character. Curses has no EOL marker, so track strings of
323 * spaces, and copy the trailing spaces only if there's a non-space
324 * character following.
326 if (!F_ISSET(sp, SC_SCR_EXWROTE) && IS_SPLIT(sp)) {
327 getyx(win, y, x);
328 #ifdef mvchgat
329 mvwchgat(win, RLNO(sp, LASTLINE(sp)), 0, -1, A_NORMAL, 0, NULL);
330 #else
331 for (lno = RLNO(sp, LASTLINE(sp)), col = spcnt = 0;;) {
332 (void)wmove(win, lno, col);
333 ch = winch(win);
334 if (isblank(ch))
335 ++spcnt;
336 else {
337 (void)wmove(win, lno, col - spcnt);
338 for (; spcnt > 0; --spcnt)
339 (void)waddch(win, ' ');
340 (void)waddch(win, ch);
342 if (++col >= sp->cols)
343 break;
345 #endif
346 (void)wmove(win, y, x);
350 * The bottom line is expected to be blank after this operation,
351 * and other screens must support that semantic.
353 return (wdeleteln(win) == ERR);
357 * cl_discard --
358 * Discard a screen.
360 * PUBLIC: int cl_discard __P((SCR *, SCR **));
363 cl_discard(discardp, acquirep)
364 SCR *discardp, **acquirep;
366 CL_PRIVATE *clp;
367 SCR* tsp;
369 if (discardp) {
370 clp = CLP(discardp);
371 F_SET(clp, CL_LAYOUT);
373 if (CLSP(discardp)) {
374 delwin(CLSP(discardp));
375 CLSP(discardp) = NULL;
379 /* no screens got a piece; we're done */
380 if (!acquirep)
381 return 0;
383 for (; (tsp = *acquirep) != NULL; ++acquirep) {
384 clp = CLP(tsp);
385 F_SET(clp, CL_LAYOUT);
387 if (CLSP(tsp))
388 delwin(CLSP(tsp));
389 CLSP(tsp) = subwin(stdscr, tsp->rows, tsp->cols,
390 tsp->roff, tsp->coff);
393 /* discardp is going away, acquirep is taking up its space. */
394 return (0);
398 * cl_ex_adjust --
399 * Adjust the screen for ex. This routine is purely for standalone
400 * ex programs. All special purpose, all special case.
402 * PUBLIC: int cl_ex_adjust __P((SCR *, exadj_t));
405 cl_ex_adjust(sp, action)
406 SCR *sp;
407 exadj_t action;
409 CL_PRIVATE *clp;
410 int cnt;
412 clp = CLP(sp);
413 switch (action) {
414 case EX_TERM_SCROLL:
415 /* Move the cursor up one line if that's possible. */
416 if (clp->cuu1 != NULL)
417 (void)tputs(clp->cuu1, 1, cl_putchar);
418 else if (clp->cup != NULL)
419 (void)tputs(tgoto(clp->cup,
420 0, LINES - 2), 1, cl_putchar);
421 else
422 return (0);
423 /* FALLTHROUGH */
424 case EX_TERM_CE:
425 /* Clear the line. */
426 if (clp->el != NULL) {
427 (void)putchar('\r');
428 (void)tputs(clp->el, 1, cl_putchar);
429 } else {
431 * Historically, ex didn't erase the line, so, if the
432 * displayed line was only a single glyph, and <eof>
433 * was more than one glyph, the output would not fully
434 * overwrite the user's input. To fix this, output
435 * the maxiumum character number of spaces. Note,
436 * this won't help if the user entered extra prompt
437 * or <blank> characters before the command character.
438 * We'd have to do a lot of work to make that work, and
439 * it's almost certainly not worth the effort.
441 for (cnt = 0; cnt < MAX_CHARACTER_COLUMNS; ++cnt)
442 (void)putchar('\b');
443 for (cnt = 0; cnt < MAX_CHARACTER_COLUMNS; ++cnt)
444 (void)putchar(' ');
445 (void)putchar('\r');
446 (void)fflush(stdout);
448 break;
449 default:
450 abort();
452 return (0);
456 * cl_insertln --
457 * Push down the current line, discarding the bottom line.
459 * PUBLIC: int cl_insertln __P((SCR *));
462 cl_insertln(sp)
463 SCR *sp;
465 WINDOW *win;
466 win = CLSP(sp) ? CLSP(sp) : stdscr;
468 * The current line is expected to be blank after this operation,
469 * and the screen must support that semantic.
471 return (winsertln(win) == ERR);
475 * cl_keyval --
476 * Return the value for a special key.
478 * PUBLIC: int cl_keyval __P((SCR *, scr_keyval_t, CHAR_T *, int *));
481 cl_keyval(sp, val, chp, dnep)
482 SCR *sp;
483 scr_keyval_t val;
484 CHAR_T *chp;
485 int *dnep;
487 CL_PRIVATE *clp;
490 * VEOF, VERASE and VKILL are required by POSIX 1003.1-1990,
491 * VWERASE is a 4BSD extension.
493 clp = CLP(sp);
494 switch (val) {
495 case KEY_VEOF:
496 *dnep = (*chp = clp->orig.c_cc[VEOF]) == _POSIX_VDISABLE;
497 break;
498 case KEY_VERASE:
499 *dnep = (*chp = clp->orig.c_cc[VERASE]) == _POSIX_VDISABLE;
500 break;
501 case KEY_VKILL:
502 *dnep = (*chp = clp->orig.c_cc[VKILL]) == _POSIX_VDISABLE;
503 break;
504 #ifdef VWERASE
505 case KEY_VWERASE:
506 *dnep = (*chp = clp->orig.c_cc[VWERASE]) == _POSIX_VDISABLE;
507 break;
508 #endif
509 default:
510 *dnep = 1;
511 break;
513 return (0);
517 * cl_move --
518 * Move the cursor.
520 * PUBLIC: int cl_move __P((SCR *, size_t, size_t));
523 cl_move(sp, lno, cno)
524 SCR *sp;
525 size_t lno, cno;
527 WINDOW *win;
528 win = CLSP(sp) ? CLSP(sp) : stdscr;
529 /* See the comment in cl_cursor. */
530 if (wmove(win, RLNO(sp, lno), RCNO(sp, cno)) == ERR) {
531 msgq(sp, M_ERR, "Error: move: l(%u + %u) c(%u + %u)",
532 lno, sp->roff, cno, sp->coff);
533 return (1);
535 return (0);
539 * cl_refresh --
540 * Refresh the screen.
542 * PUBLIC: int cl_refresh __P((SCR *, int));
545 cl_refresh(sp, repaint)
546 SCR *sp;
547 int repaint;
549 GS *gp;
550 CL_PRIVATE *clp;
551 WINDOW *win;
552 SCR *psp, *tsp;
553 size_t y, x;
555 gp = sp->gp;
556 clp = CLP(sp);
557 win = CLSP(sp) ? CLSP(sp) : stdscr;
560 * If we received a killer signal, we're done, there's no point
561 * in refreshing the screen.
563 if (clp->killersig)
564 return (0);
567 * If repaint is set, the editor is telling us that we don't know
568 * what's on the screen, so we have to repaint from scratch.
570 * If repaint set or the screen layout changed, we need to redraw
571 * any lines separating vertically split screens. If the horizontal
572 * offsets are the same, then the split was vertical, and need to
573 * draw a dividing line.
575 if (repaint || F_ISSET(clp, CL_LAYOUT)) {
576 getyx(win, y, x);
577 for (psp = sp;
578 psp != (void *)&sp->wp->scrq; psp = psp->q.cqe_next)
579 for (tsp = psp->q.cqe_next;
580 tsp != (void *)&sp->wp->scrq;
581 tsp = tsp->q.cqe_next)
582 if (psp->roff == tsp->roff) {
583 if (psp->coff + psp->cols + 1 == tsp->coff)
584 cl_rdiv(psp);
585 else
586 if (tsp->coff + tsp->cols + 1 == psp->coff)
587 cl_rdiv(tsp);
589 (void)wmove(win, y, x);
590 F_CLR(clp, CL_LAYOUT);
594 * In the curses library, doing wrefresh(curscr) is okay, but the
595 * screen flashes when we then apply the refresh() to bring it up
596 * to date. So, use clearok().
598 if (repaint)
599 clearok(curscr, 1);
600 return (wrefresh(stdscr) == ERR || wrefresh(win) == ERR);
604 * cl_rdiv --
605 * Draw a dividing line between two vertically split screens.
607 static void
608 cl_rdiv(sp)
609 SCR *sp;
611 WINDOW *win;
612 size_t cnt;
614 win = CLSP(sp) ? CLSP(sp) : stdscr;
616 for (cnt = 0; cnt < sp->rows - 1; ++cnt) {
617 wmove(stdscr, sp->roff + cnt, sp->cols + sp->coff);
618 waddch(stdscr, '|');
623 * cl_rename --
624 * Rename the file.
626 * PUBLIC: int cl_rename __P((SCR *, char *, int));
629 cl_rename(sp, name, on)
630 SCR *sp;
631 char *name;
632 int on;
634 CL_PRIVATE *clp;
635 FILE *pfp;
636 GS *gp;
637 char buf[256], *p;
639 gp = sp->gp;
640 clp = CLP(sp);
642 if (on) {
643 if (!F_ISSET(clp, CL_RENAME_OK))
644 return (0);
647 * XXX
648 * We can only rename windows for xterm.
650 if (strncmp(OG_STR(gp, GO_TERM), "xterm", sizeof("xterm") - 1))
651 return (0);
654 * XXX
655 * Try and figure out the current name of this window. There
656 * are two forms of the xwininfo output I've seen:
658 * Window id: 0x400000d "name"
659 * Window id: 0x140000d (name)
661 #define COMMAND \
662 "expr \"`xwininfo -id $WINDOWID | grep id:`\" : '.* [\"(]\\(.*\\)[\")]'"
664 if (clp->oname == NULL &&
665 (pfp = popen(COMMAND, "r")) != NULL) {
666 if (fgets(buf, sizeof(buf), pfp) != NULL &&
667 (p = strchr(buf, '\n')) != NULL) {
668 *p = '\0';
669 clp->oname = strdup(buf);
671 (void)fclose(pfp);
674 cl_setname(gp, name);
676 F_SET(clp, CL_RENAME);
677 } else
678 if (F_ISSET(clp, CL_RENAME)) {
679 cl_setname(gp, clp->oname);
681 F_CLR(clp, CL_RENAME);
683 return (0);
687 * cl_setname --
688 * Set a X11 icon/window name.
690 * PUBLIC: void cl_setname __P((GS *, char *));
692 void
693 cl_setname(gp, name)
694 GS *gp;
695 char *name;
697 /* X11 xterm escape sequence to rename the icon/window. */
698 #define XTERM_RENAME "\033]0;%s\007"
700 (void)printf(XTERM_RENAME, name == NULL ? OG_STR(gp, GO_TERM) : name);
701 (void)fflush(stdout);
705 * cl_split --
706 * Split a screen.
708 * PUBLIC: int cl_split __P((SCR *, SCR *));
711 cl_split(origp, newp)
712 SCR *origp, *newp;
714 CL_PRIVATE *clp;
716 clp = CLP(origp);
717 F_SET(clp, CL_LAYOUT);
719 if (CLSP(origp))
720 delwin(CLSP(origp));
722 CLSP(origp) = subwin(stdscr, origp->rows, origp->cols,
723 origp->roff, origp->coff);
724 CLSP(newp) = subwin(stdscr, newp->rows, newp->cols,
725 newp->roff, newp->coff);
727 /* origp is the original screen, giving up space to newp. */
728 return (0);
732 * cl_suspend --
733 * Suspend a screen.
735 * PUBLIC: int cl_suspend __P((SCR *, int *));
738 cl_suspend(sp, allowedp)
739 SCR *sp;
740 int *allowedp;
742 struct termios t;
743 CL_PRIVATE *clp;
744 WINDOW *win;
745 GS *gp;
746 size_t y, x;
747 int changed;
749 gp = sp->gp;
750 clp = CLP(sp);
751 win = CLSP(sp) ? CLSP(sp) : stdscr;
752 *allowedp = 1;
755 * The ex implementation of this function isn't needed by screens not
756 * supporting ex commands that require full terminal canonical mode
757 * (e.g. :suspend).
759 * The vi implementation of this function isn't needed by screens not
760 * supporting vi process suspension, i.e. any screen that isn't backed
761 * by a UNIX shell.
763 * Setting allowedp to 0 will cause the editor to reject the command.
765 if (F_ISSET(sp, SC_EX)) {
766 /* Save the terminal settings, and restore the original ones. */
767 if (F_ISSET(clp, CL_STDIN_TTY)) {
768 (void)tcgetattr(STDIN_FILENO, &t);
769 (void)tcsetattr(STDIN_FILENO,
770 TCSASOFT | TCSADRAIN, &clp->orig);
773 /* Stop the process group. */
774 (void)kill(0, SIGTSTP);
776 /* Time passes ... */
778 /* Restore terminal settings. */
779 if (F_ISSET(clp, CL_STDIN_TTY))
780 (void)tcsetattr(STDIN_FILENO, TCSASOFT | TCSADRAIN, &t);
781 return (0);
785 * Move to the lower left-hand corner of the screen.
787 * XXX
788 * Not sure this is necessary in System V implementations, but it
789 * shouldn't hurt.
791 getyx(win, y, x);
792 (void)wmove(win, LINES - 1, 0);
793 (void)wrefresh(win);
796 * Temporarily end the screen. System V introduced a semantic where
797 * endwin() could be restarted. We use it because restarting curses
798 * from scratch often fails in System V. 4BSD curses didn't support
799 * restarting after endwin(), so we have to do what clean up we can
800 * without calling it.
802 /* Save the terminal settings. */
803 (void)tcgetattr(STDIN_FILENO, &t);
805 /* Restore the cursor keys to normal mode. */
806 (void)keypad(stdscr, FALSE);
808 /* Restore the window name. */
809 (void)cl_rename(sp, NULL, 0);
811 #ifdef HAVE_BSD_CURSES
812 (void)cl_attr(sp, SA_ALTERNATE, 0);
813 #else
814 (void)endwin();
815 #endif
817 * XXX
818 * Restore the original terminal settings. This is bad -- the
819 * reset can cause character loss from the tty queue. However,
820 * we can't call endwin() in BSD curses implementations, and too
821 * many System V curses implementations don't get it right.
823 (void)tcsetattr(STDIN_FILENO, TCSADRAIN | TCSASOFT, &clp->orig);
825 /* Stop the process group. */
826 (void)kill(0, SIGTSTP);
828 /* Time passes ... */
831 * If we received a killer signal, we're done. Leave everything
832 * unchanged. In addition, the terminal has already been reset
833 * correctly, so leave it alone.
835 if (clp->killersig) {
836 F_CLR(clp, CL_SCR_EX_INIT | CL_SCR_VI_INIT);
837 return (0);
840 /* Restore terminal settings. */
841 wrefresh(win); /* Needed on SunOs/Solaris ? */
842 if (F_ISSET(clp, CL_STDIN_TTY))
843 (void)tcsetattr(STDIN_FILENO, TCSASOFT | TCSADRAIN, &t);
845 #ifdef HAVE_BSD_CURSES
846 (void)cl_attr(sp, SA_ALTERNATE, 1);
847 #endif
849 /* Set the window name. */
850 (void)cl_rename(sp, sp->frp->name, 1);
852 /* Put the cursor keys into application mode. */
853 (void)keypad(stdscr, TRUE);
855 /* Refresh and repaint the screen. */
856 (void)wmove(win, y, x);
857 (void)cl_refresh(sp, 1);
859 /* If the screen changed size, set the SIGWINCH bit. */
860 if (cl_ssize(sp, 1, NULL, NULL, &changed))
861 return (1);
862 if (changed)
863 F_SET(CLP(sp), CL_SIGWINCH);
865 return (0);
869 * cl_usage --
870 * Print out the curses usage messages.
872 * PUBLIC: void cl_usage __P((void));
874 void
875 cl_usage()
877 #define USAGE "\
878 usage: ex [-eFRrSsv] [-c command] [-t tag] [-w size] [file ...]\n\
879 usage: vi [-eFlRrSv] [-c command] [-t tag] [-w size] [file ...]\n"
880 (void)fprintf(stderr, "%s", USAGE);
881 #undef USAGE
884 #ifdef DEBUG
886 * gdbrefresh --
887 * Stub routine so can flush out curses screen changes using gdb.
890 gdbrefresh()
892 refresh();
893 return (0); /* XXX Convince gdb to run it. */
895 #endif