rework SEQ's to sort on more than the first character of the input
[nvi.git] / ex / ex_screen.c
blob31bfad47b5f18ae26bbd5222903568029e4f409d
1 /*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
6 */
8 #ifndef lint
9 static char sccsid[] = "$Id: ex_screen.c,v 8.8 1993/11/23 10:25:49 bostic Exp $ (Berkeley) $Date: 1993/11/23 10:25:49 $";
10 #endif /* not lint */
12 #include <sys/types.h>
14 #include <stdlib.h>
15 #include <string.h>
17 #include "vi.h"
18 #include "excmd.h"
21 * ex_split -- :s[plit] [file ...]
22 * Split the screen, optionally setting the file list.
24 int
25 ex_split(sp, ep, cmdp)
26 SCR *sp;
27 EXF *ep;
28 EXCMDARG *cmdp;
30 return (sp->s_split(sp, cmdp->argc ? cmdp->argv : NULL));
34 * ex_bg -- :bg
35 * Hide the screen.
37 int
38 ex_bg(sp, ep, cmdp)
39 SCR *sp;
40 EXF *ep;
41 EXCMDARG *cmdp;
43 return (sp->s_bg(sp));
47 * ex_fg -- :fg [file]
48 * Show the screen.
50 int
51 ex_fg(sp, ep, cmdp)
52 SCR *sp;
53 EXF *ep;
54 EXCMDARG *cmdp;
56 return (sp->s_fg(sp, cmdp->argc ? cmdp->argv[0] : NULL));
60 * ex_resize -- :resize [change]
61 * Change the screen size.
63 int
64 ex_resize(sp, ep, cmdp)
65 SCR *sp;
66 EXF *ep;
67 EXCMDARG *cmdp;
69 if (!F_ISSET(cmdp, E_COUNT))
70 cmdp->count = 1;
71 return (sp->s_resize(sp, cmdp->count));
75 * ex_sdisplay --
76 * Display the list of screens.
78 int
79 ex_sdisplay(sp, ep)
80 SCR *sp;
81 EXF *ep;
83 SCR *tsp;
84 int cnt, col, len, sep;
86 if ((tsp = sp->gp->hq.cqh_first) == (void *)&sp->gp->hq) {
87 (void)ex_printf(EXCOOKIE,
88 "No backgrounded screens to display.\n");
89 return (0);
92 col = len = sep = 0;
93 for (cnt = 1; tsp != (void *)&sp->gp->hq; tsp = tsp->q.cqe_next) {
94 col += len = tsp->frp->nlen + sep;
95 if (col >= sp->cols - 1) {
96 col = len;
97 sep = 0;
98 (void)ex_printf(EXCOOKIE, "\n");
99 } else if (cnt != 1) {
100 sep = 1;
101 (void)ex_printf(EXCOOKIE, " ");
103 (void)ex_printf(EXCOOKIE, "%s", FILENAME(tsp->frp));
104 ++cnt;
106 (void)ex_printf(EXCOOKIE, "\n");
107 return (0);