editline.h (1623B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 7 */ 8 9 #if !defined(_SAL_EDITLINE_H) 10 #define _SAL_EDITLINE_H 11 12 #ifdef INCLUDE_EDITLINE 13 14 #if !defined(CONST) 15 #if defined(__STDC__) 16 #define CONST const 17 #else 18 #define CONST 19 #endif /* defined(__STDC__) */ 20 #endif /* !defined(CONST) */ 21 22 extern char *readline(CONST char *prompt); 23 extern void add_history(char *p); 24 25 /* editline asynchronous callback interface */ 26 27 /** Called when an end of line is reached. */ 28 typedef void (*rl_vcpfunc_t)(char *line, void *ctx); 29 /** Called when an end of file is reached. */ 30 typedef void (*rf_vcpfunc_t)(void *ctx); 31 extern void rl_callback_read_char(CONST char *prompt); 32 33 /** Called when asynchronous edit line support is no longer needed. */ 34 extern void rl_callback_handler_remove(void **eolCtx, void **eofCtx); 35 36 /** Must be called initially to enable asynchronous edit line support. */ 37 extern void rl_callback_handler_install(CONST char *prompt, 38 rl_vcpfunc_t eol_handler, void *eolCtx, 39 rf_vcpfunc_t eof_handler, void *eofCtx); 40 41 42 typedef struct rl_input_state_s { 43 unsigned char *line; 44 int point; 45 } rl_input_state_t; 46 47 extern void rl_input_state(rl_input_state_t *state); 48 49 extern char *(*rl_complete)(char *, int *); 50 extern int (*rl_list_possib)(char *, char ***); 51 52 #endif /* INCLUDE_EDITLINE */ 53 54 #endif /* _SAL_EDITLINE_H */ 55