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