2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
13 static const char sccsid
[] = "$Id: ex_display.c,v 10.14 2000/07/22 17:31:21 skimo Exp $ (Berkeley) $Date: 2000/07/22 17:31:21 $";
16 #include <sys/types.h>
17 #include <sys/queue.h>
19 #include <bitstring.h>
25 #include "../common/common.h"
28 static int bdisplay
__P((SCR
*));
29 static void db
__P((SCR
*, CB
*, u_char
*));
32 * ex_display -- :display b[uffers] | c[onnections] | s[creens] | t[ags]
34 * Display cscope connections, buffers, tags or screens.
36 * PUBLIC: int ex_display __P((SCR *, EXCMD *));
43 switch (cmdp
->argv
[0]->bp
[0]) {
47 if (cmdp
->argv
[0]->len
>= sizeof(ARG
) ||
48 memcmp(cmdp
->argv
[0]->bp
, ARG
, cmdp
->argv
[0]->len
))
50 return (bdisplay(sp
));
53 #define ARG "connections"
54 if (cmdp
->argv
[0]->len
>= sizeof(ARG
) ||
55 memcmp(cmdp
->argv
[0]->bp
, ARG
, cmdp
->argv
[0]->len
))
57 return (cscope_display(sp
));
61 if (cmdp
->argv
[0]->len
>= sizeof(ARG
) ||
62 memcmp(cmdp
->argv
[0]->bp
, ARG
, cmdp
->argv
[0]->len
))
64 return (ex_sdisplay(sp
));
68 if (cmdp
->argv
[0]->len
>= sizeof(ARG
) ||
69 memcmp(cmdp
->argv
[0]->bp
, ARG
, cmdp
->argv
[0]->len
))
71 return (ex_tag_display(sp
));
73 ex_emsg(sp
, cmdp
->cmd
->usage
, EXM_USAGE
);
88 if (sp
->wp
->cutq
.lh_first
== NULL
&& sp
->wp
->dcbp
== NULL
) {
89 msgq(sp
, M_INFO
, "123|No cut buffers to display");
93 /* Display regular cut buffers. */
94 for (cbp
= sp
->wp
->cutq
.lh_first
; cbp
!= NULL
; cbp
= cbp
->q
.le_next
) {
95 if (isdigit(cbp
->name
))
97 if (cbp
->textq
.cqh_first
!= (void *)&cbp
->textq
)
102 /* Display numbered buffers. */
103 for (cbp
= sp
->wp
->cutq
.lh_first
; cbp
!= NULL
; cbp
= cbp
->q
.le_next
) {
104 if (!isdigit(cbp
->name
))
106 if (cbp
->textq
.cqh_first
!= (void *)&cbp
->textq
)
111 /* Display default buffer. */
112 if ((cbp
= sp
->wp
->dcbp
) != NULL
)
113 db(sp
, cbp
, "default buffer");
133 (void)ex_printf(sp
, "********** %s%s\n",
134 name
== NULL
? KEY_NAME(sp
, cbp
->name
) : name
,
135 F_ISSET(cbp
, CB_LMODE
) ? " (line mode)" : " (character mode)");
136 for (tp
= cbp
->textq
.cqh_first
;
137 tp
!= (void *)&cbp
->textq
; tp
= tp
->q
.cqe_next
) {
138 for (len
= tp
->len
, p
= tp
->lb
; len
--; ++p
) {
139 (void)ex_puts(sp
, KEY_NAME(sp
, *p
));
143 (void)ex_puts(sp
, "\n");