xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_cmdbuf.h (revision 90f050286227cf4c4f8aa425555d04723d331d48)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1997-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MDB_CMDBUF_H
28 #define	_MDB_CMDBUF_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 typedef struct mdb_cmdbuf {
39 	char **cmd_history;	/* Circular array of history buffers */
40 	char *cmd_linebuf;	/* Temporary history for current buffer */
41 	char *cmd_buf;		/* Current line buffer */
42 	size_t cmd_linelen;	/* Maximum line length */
43 	size_t cmd_histlen;	/* Maximum history entries */
44 	size_t cmd_buflen;	/* Number of bytes in current line buffer */
45 	size_t cmd_bufidx;	/* Byte position in current line buffer */
46 	ssize_t cmd_hold;	/* Oldest history entry index */
47 	ssize_t cmd_hnew;	/* Newest history entry index */
48 	ssize_t cmd_hcur;	/* Current history entry index */
49 	ssize_t cmd_hlen;	/* Number of valid history buffers */
50 } mdb_cmdbuf_t;
51 
52 #ifdef _MDB
53 
54 extern void mdb_cmdbuf_create(mdb_cmdbuf_t *);
55 extern void mdb_cmdbuf_destroy(mdb_cmdbuf_t *);
56 
57 extern const char *mdb_cmdbuf_accept(mdb_cmdbuf_t *);
58 
59 extern int mdb_cmdbuf_caninsert(mdb_cmdbuf_t *, size_t);
60 extern int mdb_cmdbuf_atstart(mdb_cmdbuf_t *);
61 extern int mdb_cmdbuf_atend(mdb_cmdbuf_t *);
62 
63 extern int mdb_cmdbuf_insert(mdb_cmdbuf_t *, int);
64 extern int mdb_cmdbuf_backspace(mdb_cmdbuf_t *, int);
65 extern int mdb_cmdbuf_delchar(mdb_cmdbuf_t *, int);
66 extern int mdb_cmdbuf_fwdchar(mdb_cmdbuf_t *, int);
67 extern int mdb_cmdbuf_backchar(mdb_cmdbuf_t *, int);
68 extern int mdb_cmdbuf_transpose(mdb_cmdbuf_t *, int);
69 extern int mdb_cmdbuf_home(mdb_cmdbuf_t *, int);
70 extern int mdb_cmdbuf_end(mdb_cmdbuf_t *, int);
71 extern int mdb_cmdbuf_fwdword(mdb_cmdbuf_t *, int);
72 extern int mdb_cmdbuf_backword(mdb_cmdbuf_t *, int);
73 extern int mdb_cmdbuf_killfwdword(mdb_cmdbuf_t *, int);
74 extern int mdb_cmdbuf_killbackword(mdb_cmdbuf_t *, int);
75 extern int mdb_cmdbuf_kill(mdb_cmdbuf_t *, int);
76 extern int mdb_cmdbuf_reset(mdb_cmdbuf_t *, int);
77 extern int mdb_cmdbuf_prevhist(mdb_cmdbuf_t *, int);
78 extern int mdb_cmdbuf_nexthist(mdb_cmdbuf_t *, int);
79 extern int mdb_cmdbuf_findhist(mdb_cmdbuf_t *, int);
80 
81 #endif /* _MDB */
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _MDB_CMDBUF_H */
88