Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_cons.h>
#include <rz_core.h>
#include <string.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <signal.h>
Go to the source code of this file.
Macros | |
#define | USE_UTF8 1 |
Enumerations | |
enum | BreakMode { MINOR_BREAK , MAJOR_BREAK } |
Variables | |
static char * | rz_line_nullstr = "" |
static const char | word_break_characters [] = "\t\n ~`!@#$%^&*()-_=+[]{}\\|;:\"'<>,./" |
#define USE_UTF8 1 |
Definition at line 19 of file dietline.c.
enum BreakMode |
|
inlinestatic |
Definition at line 931 of file dietline.c.
References I, len, and rz_str_utf8_charsize().
Referenced by __vi_mode(), and rz_line_readline_cb().
|
inlinestatic |
Definition at line 941 of file dietline.c.
References I, len, rz_str_utf8_charsize_last(), and rz_str_utf8_charsize_prev().
Referenced by __vi_mode(), and rz_line_readline_cb().
|
inlinestatic |
Definition at line 1009 of file dietline.c.
References I, and rz_str_utf8_charsize_prev().
Referenced by __vi_mode(), and rz_line_readline_cb().
|
inlinestatic |
Definition at line 1003 of file dietline.c.
References I, and rz_str_utf8_charsize().
Referenced by __vi_mode(), and rz_line_readline_cb().
|
static |
Definition at line 970 of file dietline.c.
References rz_cons_context_t::color_mode, Color_RESET, rz_cons_t::context, I, i, len, rz_cons_t::line, NULL, printf(), rz_line_t::prompt_type, rz_cons_t::rows, rz_cons_clear_line(), rz_cons_flush(), rz_cons_get_size(), rz_cons_gotoxy(), rz_cons_singleton(), RZ_LINE_PROMPT_OFFSET, RZ_MAX, RZ_MIN, and rz_str_ansi_len().
Referenced by __vi_mode(), and rz_line_readline_cb().
|
static |
Definition at line 1093 of file dietline.c.
References rz_cons_context_t::color_mode, rz_cons_t::context, CONTROL_MODE, free(), I, INSERT_MODE, rz_cons_printable_palette_t::invalid, rz_cons_context_t::pal, prompt(), rz_cons_printable_palette_t::prompt, rz_cons_printable_palette_t::reset, rz_cons_singleton(), rz_str_escape(), and rz_str_newf().
Referenced by __vi_mode().
|
static |
Definition at line 1118 of file dietline.c.
References __delete_next_char(), __delete_prev_char(), __move_cursor_left(), __move_cursor_right(), __print_prompt(), __update_prompt_color(), backward_kill_word(), c, CONTROL_MODE, delete_till_end(), eprintf, I, INSERT_MODE, IS_DIGIT, kill_word(), MAJOR_BREAK, MINOR_BREAK, paste(), rz_cons_arrow_to_hjkl(), rz_cons_readchar(), rz_line_hist_down(), rz_line_hist_up(), autogen_x86imm::tmp, tolower, vi_cmd_b(), vi_cmd_B(), vi_cmd_E(), vi_cmd_e(), vi_cmd_W(), and vi_cmd_w().
Referenced by rz_line_readline_cb().
|
static |
Definition at line 44 of file dietline.c.
References free(), I, i, is_word_break_char(), len, rz_line_clipboard_push(), and rz_str_ndup().
Referenced by __vi_mode(), and rz_line_readline_cb().
|
inlinestatic |
|
static |
Definition at line 726 of file dietline.c.
References options, rz_pvector_at(), rz_pvector_foreach, rz_str_ndup(), and s.
Referenced by rz_line_autocomplete().
|
static |
Definition at line 133 of file dietline.c.
References calloc(), I, RZ_LINE_HISTSIZE, and ZERO_FILL.
Referenced by rz_line_dietline_init(), rz_line_hist_add(), rz_line_hist_cmd_down(), rz_line_hist_cmd_up(), rz_line_hist_get(), and rz_line_hist_list().
|
static |
Definition at line 698 of file dietline.c.
References test_evm::end, RZ_LINE_BUFSIZE, and start.
Referenced by replace_buffer_text().
Definition at line 30 of file dietline.c.
References i, MAJOR_BREAK, RZ_ARRAY_SIZE, and word_break_characters.
Referenced by backward_kill_word(), kill_word(), rz_line_readline_cb(), vi_cmd_b(), vi_cmd_B(), vi_cmd_E(), vi_cmd_e(), vi_cmd_W(), and vi_cmd_w().
|
static |
Definition at line 73 of file dietline.c.
References free(), I, i, is_word_break_char(), len, rz_line_clipboard_push(), and rz_str_ndup().
Referenced by __vi_mode(), and rz_line_readline_cb().
|
inlinestatic |
Definition at line 301 of file dietline.c.
References rz_str_startswith().
Referenced by rz_line_hist_cmd_down(), and rz_line_hist_cmd_up().
|
static |
Definition at line 89 of file dietline.c.
References I, len, and memcpy().
Referenced by __vi_mode(), rotate_kill_ring(), and rz_line_readline_cb().
Definition at line 747 of file dietline.c.
References argv, i, int, len, NULL, rz_cons_get_size(), and rz_cons_printf().
Referenced by rz_line_autocomplete().
|
static |
Definition at line 627 of file dietline.c.
References Color_RESET, I, rz_cons_clear_line(), rz_cons_flush(), and rz_cons_printf().
Referenced by selection_widget_erase().
|
static |
Definition at line 711 of file dietline.c.
References test_evm::end, is_valid_buffer_limits(), s, and start.
Referenced by rz_line_autocomplete().
|
inlinestatic |
Definition at line 917 of file dietline.c.
References I, paste(), and rz_list_get_n().
Referenced by rz_line_readline_cb().
RZ_API void rz_line_autocomplete | ( | void | ) |
Definition at line 775 of file dietline.c.
References argv, rz_line_ns_completion_result_t::end, rz_line_ns_completion_result_t::end_string, free(), get_max_common_pfx(), I, i, memcpy(), NULL, rz_line_ns_completion_result_t::options, p, print_options(), replace_buffer_text(), root, rz_cons_printf(), rz_cons_singleton(), rz_line_ns_completion_result_free(), RZ_LINE_PROMPT_DEFAULT, rz_pvector_at(), rz_pvector_data(), rz_pvector_empty(), rz_pvector_len(), rz_sub_str_lchr(), rz_sub_str_rchr(), RZ_SYS_DIR, selection_widget_update(), rz_cons_t::show_autocomplete_widget, and rz_line_ns_completion_result_t::start.
Referenced by rz_line_readline_cb().
Definition at line 147 of file dietline.c.
References I, inithist(), and ZERO_FILL.
Referenced by rz_line_new().
Definition at line 382 of file dietline.c.
References free(), I, i, inithist(), setup::line, and strdup().
Referenced by __rtr_shell(), core_cmd_tsrzcmd(), rtr_visual(), rz_core_visual_prompt(), rz_lang_prompt(), and rz_line_hist_load().
Definition at line 528 of file dietline.c.
Definition at line 346 of file dietline.c.
References i, inithist(), setup::line, match_hist_line(), RZ_LINE_BUFSIZE, and setup_hist_match().
Referenced by __break_points_cb(), __open_file_cb(), rz_cmd_kuery(), rz_core_visual_offset(), rz_line_hist_down(), rz_line_hist_up(), and visual_offset().
Definition at line 316 of file dietline.c.
References i, inithist(), setup::line, match_hist_line(), RZ_LINE_BUFSIZE, and setup_hist_match().
Referenced by __break_points_cb(), __open_file_cb(), rz_cmd_kuery(), rz_core_visual_offset(), rz_line_hist_down(), rz_line_hist_up(), and visual_offset().
|
static |
Definition at line 417 of file dietline.c.
References I, rz_line_hist_cmd_down(), rz_line_hist_cmd_up(), and rz_line_set_hist_callback().
Referenced by __vi_mode(), and rz_line_readline_cb().
RZ_API void rz_line_hist_free | ( | void | ) |
Definition at line 455 of file dietline.c.
Referenced by rz_history_clear_handler(), and rz_line_free().
Definition at line 424 of file dietline.c.
References I, i, inithist(), n, and NULL.
Referenced by rz_history_list_or_exec_handler().
Definition at line 440 of file dietline.c.
References I, i, inithist(), and rz_cons_printf().
Referenced by rz_history_list_or_exec_handler(), and rz_line_readline_cb().
RZ_API int rz_line_hist_load | ( | RZ_NONNULL const char * | path | ) |
Load the history of commands from path
.
path | Path of the history file, where commands executed in the shell were saved in a previous session |
Definition at line 474 of file dietline.c.
References fd, benchmark::FILE, NULL, path, RZ_LINE_BUFSIZE, rz_line_hist_add(), rz_return_val_if_fail, rz_str_trim_tail(), and rz_sys_fopen().
Referenced by rz_core_init().
RZ_API int rz_line_hist_save | ( | RZ_NONNULL const char * | path | ) |
Save the history of commands executed until now to file path
.
path | Path of the history file, where commands executed in the shell will be saved |
Definition at line 497 of file dietline.c.
References fd, benchmark::FILE, I, i, NULL, p, path, RZ_LOG_ERROR, RZ_STR_ISEMPTY, rz_str_lastbut(), RZ_SYS_DIR, rz_sys_fopen(), and rz_sys_mkdirp().
Referenced by rz_history_save_handler(), and rz_main_rizin().
|
static |
Definition at line 410 of file dietline.c.
References I, rz_line_hist_cmd_down(), rz_line_hist_cmd_up(), and rz_line_set_hist_callback().
Referenced by __vi_mode(), and rz_line_readline_cb().
Definition at line 158 of file dietline.c.
References i, len, read(), rz_cons_controlz(), rz_cons_readchar(), and s.
Referenced by rz_line_readline_cb().
Definition at line 913 of file dietline.c.
References NULL, and rz_line_readline_cb().
Referenced by __input_cb(), __rtr_shell(), rz_cons_hud(), rz_cons_less_str(), rz_core_fgets(), rz_core_visual_bit_editor(), rz_core_visual_cmd(), rz_core_visual_graph(), rz_core_visual_view_rop(), and rz_lang_prompt().
Definition at line 1331 of file dietline.c.
References __delete_next_char(), __delete_prev_char(), __move_cursor_left(), __move_cursor_right(), __print_prompt(), __vi_mode(), backward_kill_word(), cb, counter, eprintf, free(), HANDLE, I, i, is_word_break_char(), key, kill_word(), len, memcpy(), memset(), MINOR_BREAK, rz_cons_t::mouse, rz_cons_t::mouse_event, NULL, paste(), printf(), prompt(), rotate_kill_ring(), rz_cons_break_pop(), rz_cons_break_push(), rz_cons_clear_line(), rz_cons_enable_mouse(), rz_cons_flush(), rz_cons_get_size(), rz_cons_is_breaked(), rz_cons_readchar(), rz_cons_readchar_timeout(), rz_cons_set_raw(), rz_cons_singleton(), RZ_FREE, rz_line_autocomplete(), RZ_LINE_BUFSIZE, rz_line_clipboard_push(), rz_line_hist_down(), rz_line_hist_list(), rz_line_hist_up(), rz_line_nullstr, rz_line_readchar_utf8(), RZ_LOG_ERROR, RZ_MIN, RZ_SELWIDGET_MAXH, RZ_VIRT_TERM_MODE_COMPLETE, selection_widget_down(), selection_widget_draw(), selection_widget_erase(), selection_widget_select(), selection_widget_up(), strdup(), and unix_word_rubout().
Referenced by rz_core_visual_asm(), and rz_line_readline().
RZ_API int rz_line_set_hist_callback | ( | RzLine * | line, |
RzLineHistoryUpCb | up, | ||
RzLineHistoryDownCb | down | ||
) |
Definition at line 292 of file dietline.c.
References setup::line.
Referenced by __break_points_cb(), __open_file_cb(), rz_cmd_kuery(), rz_core_visual_offset(), rz_line_hist_down(), rz_line_hist_up(), and visual_offset().
|
static |
Definition at line 605 of file dietline.c.
References rz_selection_widget_t::direction, rz_selection_widget_t::h, height, I, rz_selection_widget_t::options_len, RZ_MAX, RZ_MIN, RZ_SELWIDGET_DIR_UP, RZ_SELWIDGET_MAXH, rz_selection_widget_t::scroll, and rz_selection_widget_t::selection.
Referenced by rz_line_readline_cb().
|
static |
Definition at line 533 of file dietline.c.
References Color_INVERT, Color_INVERT_RESET, rz_cons_context_t::color_mode, Color_RESET_BG, rz_cons_t::context, rz_selection_widget_t::direction, rz_selection_widget_t::h, I, rz_selection_widget_t::options, rz_selection_widget_t::options_len, rz_cons_context_t::pal, printf(), rz_cons_t::rows, RZ_BETWEEN, rz_cons_flush(), rz_cons_get_cur_line(), rz_cons_gotoxy(), rz_cons_memcat(), rz_cons_printf(), rz_cons_singleton(), RZ_MAX, RZ_MIN, RZ_SELWIDGET_DIR_UP, RZ_SELWIDGET_MAXH, RZ_SELWIDGET_MAXW, rz_str_ansi_len(), rz_str_pad(), rz_selection_widget_t::scroll, rz_selection_widget_t::selection, rz_selection_widget_t::w, rz_cons_printable_palette_t::widget_bg, and rz_cons_printable_palette_t::widget_sel.
Referenced by rz_line_readline_cb(), selection_widget_erase(), and selection_widget_update().
|
static |
Definition at line 633 of file dietline.c.
References rz_cons_t::cb_task_oneshot, rz_cons_t::event_data, rz_cons_t::event_resize, I, rz_selection_widget_t::options_len, print_rline_task(), printf(), RZ_CONS_CLEAR_FROM_CURSOR_TO_END, rz_cons_singleton(), RZ_FREE, rz_selection_widget_t::selection, selection_widget_draw(), rz_core_t::tasks, and rz_cons_t::user.
Referenced by rz_line_readline_cb(), selection_widget_select(), and selection_widget_update().
|
static |
Definition at line 652 of file dietline.c.
References delta, I, memcpy(), rz_selection_widget_t::options, rz_selection_widget_t::options_len, RZ_LINE_BUFSIZE, RZ_MIN, rz_selection_widget_t::selection, selection_widget_erase(), and sp.
Referenced by rz_line_readline_cb().
|
static |
Definition at line 583 of file dietline.c.
References rz_selection_widget_t::direction, rz_selection_widget_t::h, height, I, rz_selection_widget_t::options_len, RZ_MAX, RZ_MIN, RZ_SELWIDGET_DIR_UP, RZ_SELWIDGET_MAXH, rz_selection_widget_t::scroll, and rz_selection_widget_t::selection.
Referenced by rz_line_readline_cb().
|
static |
Definition at line 671 of file dietline.c.
References argv, I, rz_cons_flush(), RZ_LINE_PROMPT_DEFAULT, RZ_MAX, RZ_NEW0, rz_pvector_data(), rz_pvector_len(), RZ_SELWIDGET_DIR_DOWN, RZ_SELWIDGET_DIR_UP, selection_widget_draw(), and selection_widget_erase().
Referenced by rz_line_autocomplete().
|
static |
Definition at line 306 of file dietline.c.
References setup::line, RZ_FREE, and strdup().
Referenced by rz_line_hist_cmd_down(), and rz_line_hist_cmd_up().
|
static |
Definition at line 102 of file dietline.c.
References free(), I, i, len, rz_line_clipboard_push(), and rz_str_ndup().
Referenced by rz_line_readline_cb().
|
inlinestatic |
Definition at line 1015 of file dietline.c.
References I, i, is_word_break_char(), MAJOR_BREAK, and MINOR_BREAK.
Referenced by __vi_mode().
|
inlinestatic |
Definition at line 1028 of file dietline.c.
References I, i, is_word_break_char(), and MAJOR_BREAK.
Referenced by __vi_mode().
|
inlinestatic |
Definition at line 1067 of file dietline.c.
References I, i, is_word_break_char(), and MAJOR_BREAK.
Referenced by __vi_mode().
|
inlinestatic |
Definition at line 1080 of file dietline.c.
References I, i, is_word_break_char(), MAJOR_BREAK, and MINOR_BREAK.
Referenced by __vi_mode().
|
inlinestatic |
Definition at line 1041 of file dietline.c.
References I, i, is_word_break_char(), and MAJOR_BREAK.
Referenced by __vi_mode().
|
inlinestatic |
Definition at line 1054 of file dietline.c.
References I, i, is_word_break_char(), MAJOR_BREAK, and MINOR_BREAK.
Referenced by __vi_mode().
|
static |
Definition at line 22 of file dietline.c.
Referenced by rz_line_readline_cb().
Definition at line 23 of file dietline.c.
Referenced by is_word_break_char().