Rizin
unix-like reverse engineering framework and cli tools
main.c File Reference
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <uv.h>

Go to the source code of this file.

Functions

void update (uv_timer_t *req)
 
int main ()
 

Variables

uv_loop_tloop
 
uv_tty_t tty
 
uv_timer_t tick
 
uv_write_t write_req
 
int width
 
int height
 
int pos = 0
 
char * message = " Hello TTY "
 

Function Documentation

◆ main()

int main ( void  )

Definition at line 32 of file main.c.

32  {
34 
36  uv_tty_set_mode(&tty, 0);
37 
38  if (uv_tty_get_winsize(&tty, &width, &height)) {
39  fprintf(stderr, "Could not get TTY information\n");
41  return 1;
42  }
43 
44  fprintf(stderr, "Width %d, height %d\n", width, height);
46  uv_timer_start(&tick, update, 200, 200);
47  return uv_run(loop, UV_RUN_DEFAULT);
48 }
uv_loop_t * loop
Definition: main.c:7
int width
Definition: main.c:10
uv_timer_t tick
Definition: main.c:8
void update(uv_timer_t *req)
Definition: main.c:14
int height
Definition: main.c:10
uv_tty_t tty
Definition: main.c:7
#define STDOUT_FILENO
Definition: private.h:41
@ UV_RUN_DEFAULT
Definition: uv.h:255
UV_EXTERN int uv_timer_start(uv_timer_t *handle, uv_timer_cb cb, uint64_t timeout, uint64_t repeat)
Definition: timer.c:66
UV_EXTERN int uv_timer_init(uv_loop_t *, uv_timer_t *handle)
Definition: timer.c:58
UV_EXTERN int uv_run(uv_loop_t *, uv_run_mode mode)
Definition: core.c:365
UV_EXTERN int uv_tty_set_mode(uv_tty_t *, uv_tty_mode_t mode)
Definition: tty.c:250
UV_EXTERN int uv_tty_reset_mode(void)
Definition: tty.c:378
UV_EXTERN int uv_tty_get_winsize(uv_tty_t *, int *width, int *height)
Definition: tty.c:297
UV_EXTERN int uv_tty_init(uv_loop_t *, uv_tty_t *, uv_file fd, int readable)
Definition: tty.c:123
UV_EXTERN uv_loop_t * uv_default_loop(void)
Definition: uv-common.c:763

References height, loop, STDOUT_FILENO, tick, tty, update(), uv_default_loop(), uv_run(), UV_RUN_DEFAULT, uv_timer_init(), uv_timer_start(), uv_tty_get_winsize(), uv_tty_init(), uv_tty_reset_mode(), uv_tty_set_mode(), and width.

◆ update()

void update ( uv_timer_t req)

Definition at line 14 of file main.c.

14  {
15  char data[500];
16 
17  uv_buf_t buf;
18  buf.base = data;
19  buf.len = sprintf(data, "\033[2J\033[H\033[%dB\033[%luC\033[42;37m%s",
20  pos,
21  (unsigned long) (width-strlen(message))/2,
22  message);
24 
25  pos++;
26  if (pos > height) {
29  }
30 }
#define NULL
Definition: cris-opc.c:27
voidpf void * buf
Definition: ioapi.h:138
sprintf
Definition: kernel.h:365
Definition: unix.h:123
char * message
Definition: main.c:12
int pos
Definition: main.c:11
uv_write_t write_req
Definition: main.c:9
UV_EXTERN int uv_write(uv_write_t *req, uv_stream_t *handle, const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb)
Definition: stream.c:1492
UV_EXTERN int uv_timer_stop(uv_timer_t *handle)
Definition: timer.c:97

References height, message, NULL, pos, sprintf, tick, tty, uv_timer_stop(), uv_tty_reset_mode(), uv_write(), width, and write_req.

Referenced by main().

Variable Documentation

◆ height

◆ loop

uv_loop_t* loop

Definition at line 6 of file main.c.

◆ message

◆ pos

int pos = 0

Definition at line 11 of file main.c.

Referenced by __analysis_fcn_check_bp_use(), __init_menu_color_settings_layout(), __init_menu_disasm_asm_settings_layout(), __init_menu_disasm_settings_layout(), __init_panels_menu(), __set_geometry(), __set_pos(), __set_size(), _cb_hit(), aarch64_ext_advsimd_imm_shift(), aarch64_ext_reglane(), add_spaces(), analysis_block_cb(), basefind_create_pointer_map(), bitmapClearBit(), bitmapSetBit(), bitmapTestBit(), BMK_benchMem(), BMK_loadFiles(), buf_file_get_size(), bv_unsigned_cmp(), cdb_findnext(), cdb_getkvlen(), cdb_read(), checkBuffers(), cil_dis(), convert_elf_section(), decode_braces(), decode_ins(), decode_ret(), demangle_method(), dict_repeat(), diff_hexdump_line(), diff_hexdump_partial(), dofwd(), doinsert(), ds_print_core_vmode(), ds_print_core_vmode_jump_hit(), ds_print_shortcut(), ensure_addr_hint_record(), fill_level(), frameCheck(), fs__capture_path(), fs__read_filemap(), fs__write_filemap(), FUZ_fillCompressibleNoiseBuffer(), FUZ_test(), fuzzerTests(), get_check_names(), get_elf_segment(), get_hash_code(), get_import_addr_arm(), get_import_addr_mips(), get_import_addr_ppc(), get_import_addr_riscv(), get_import_addr_x86(), get_import_addr_x86_manual(), get_ins_part(), get_literal_price(), get_next_pointer(), get_op(), get_sibling(), get_word_from_canvas(), get_word_from_canvas_for_menu(), getargpos(), getvalue(), gzcopy(), helper2(), io_pread(), io_read(), is_valid_pos(), isLargeFile(), lang_byte_array_asm(), lang_byte_array_bash(), lang_byte_array_c_cpp(), lang_byte_array_golang(), lang_byte_array_java(), lang_byte_array_json(), lang_byte_array_kotlin(), lang_byte_array_objective_c_cpp(), lang_byte_array_rizin(), LZ4HC_compress_optimal(), LZ4HC_encodeSequence(), LZ4HC_InsertAndGetWiderMatch(), LZ4IO_decompressLZ4F(), lzh_decompress(), lzma2_header_lzma(), LZMA_API(), lzma_sha256_finish(), lzss_decompress(), lzxd_set_reference_data(), make_decode_table(), make_program_args(), match(), message_filters_to_str(), migrateCommand(), mpc_err_string(), mpc_err_string_cat(), my_snprintf(), MySetFilePointerEx(), nextword(), p_ere_exp(), p_simp_re(), parse_indexes(), parse_segment_offset(), parseOperand(), parseReg(), print_bin_content(), print_debug_maps_ascii_art(), print_heap_fastbin(), print_loop(), print_tcache_content(), progress_sizes(), rcc_mathop(), RDG_genBlock(), read_InlineBrTarget(), read_InlineMethod(), read_InlineSwitch(), read_name(), read_reset_table(), read_ShortInlineBrTarget(), readlabel(), rz_analysis_reflines_str(), rz_bin_pdb_omap_remap(), rz_bv_add(), rz_bv_append_zero(), rz_bv_cut_head(), rz_bv_cut_tail(), rz_bv_get(), rz_bv_set(), rz_bv_toggle(), rz_cmd_analysis(), rz_cmd_arena_print_handler(), rz_cmd_heap_chunks_print_handler(), rz_cons_arrow_to_hjkl(), rz_core_cmp_disasm_print(), rz_core_get_asmqjmps(), rz_core_print_string_c_cpp(), rz_core_set_asmqjmps(), rz_core_visual_bit_editor(), rz_core_visual_title(), rz_core_yank_as_string(), rz_core_yank_dump(), rz_core_yank_print(), rz_core_yank_print_hexdump(), rz_core_yank_print_string(), rz_debug_bochs_reg_read(), rz_diff_draw_tui(), rz_hash_cfg_calculate_small_block_string(), rz_hash_cfg_get_result_string(), rz_num_tail_base(), rz_num_to_bits(), rz_print_json_path(), rz_str_truncate_cmd(), rz_str_utf8_charsize_prev(), rz_table_visual_list(), rz_utf8_encode_str(), scan_go_build_info(), sdb_const_get_len(), sdb_exists(), sdb_expire_set(), sections_print_json(), seek_set(), skipword(), subvar(), test_code(), trimbits(), type_match(), uint64_to_nicestr(), unzSetOffset(), unzSetOffset64(), update(), UTIL_createFileList(), UTIL_prepareFileList(), uv__fs_preadv(), uv__random_getentropy(), uv__random_getrandom(), uv__random_readpath(), uv_tty_line_read_thread(), uv_tty_move_caret(), vreplace(), win32_seek64_file_func(), win32_seek_file_func(), win32_tell64_file_func(), win32_tell_file_func(), Write_EndOfCentralDirectoryRecord(), Write_Zip64EndOfCentralDirectoryLocator(), Write_Zip64EndOfCentralDirectoryRecord(), and zipClose().

◆ tick

uv_timer_t tick

Definition at line 8 of file main.c.

Referenced by main(), rz_core_cmd_subst_i(), and update().

◆ tty

uv_tty_t tty

Definition at line 7 of file main.c.

◆ width

◆ write_req

uv_write_t write_req

Definition at line 9 of file main.c.

Referenced by main(), on_new_connection(), on_read(), and update().