Rizin
unix-like reverse engineering framework and cli tools
main.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <string.h>
3
#include <unistd.h>
4
#include <
uv.h
>
5
6
uv_loop_t
*
loop
;
7
uv_tty_t
tty
;
8
int
main
() {
9
loop
=
uv_default_loop
();
10
11
uv_tty_init
(
loop
, &
tty
,
STDOUT_FILENO
, 0);
12
uv_tty_set_mode
(&
tty
,
UV_TTY_MODE_NORMAL
);
13
14
if
(
uv_guess_handle
(1) == UV_TTY) {
15
uv_write_t
req
;
16
uv_buf_t
buf
;
17
buf
.base =
"\033[41;37m"
;
18
buf
.len = strlen(
buf
.base);
19
uv_write
(&
req
, (
uv_stream_t
*) &
tty
, &
buf
, 1,
NULL
);
20
}
21
22
uv_write_t
req
;
23
uv_buf_t
buf
;
24
buf
.base =
"Hello TTY\n"
;
25
buf
.len = strlen(
buf
.base);
26
uv_write
(&
req
, (
uv_stream_t
*) &
tty
, &
buf
, 1,
NULL
);
27
uv_tty_reset_mode
();
28
return
uv_run
(
loop
,
UV_RUN_DEFAULT
);
29
}
NULL
#define NULL
Definition:
cris-opc.c:27
req
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
Definition:
sflib.h:128
buf
voidpf void * buf
Definition:
ioapi.h:138
main
int main(int argc, const char **argv)
Definition:
main.c:340
uv_buf_t
Definition:
unix.h:123
uv_loop_s
Definition:
uv.h:1780
uv_stream_s
Definition:
uv.h:494
uv_tty_s
Definition:
uv.h:714
uv_write_s
Definition:
uv.h:525
loop
uv_loop_t * loop
Definition:
main.c:7
tty
uv_tty_t tty
Definition:
main.c:7
STDOUT_FILENO
#define STDOUT_FILENO
Definition:
private.h:41
uv.h
UV_RUN_DEFAULT
@ UV_RUN_DEFAULT
Definition:
uv.h:255
UV_TTY_MODE_NORMAL
@ UV_TTY_MODE_NORMAL
Definition:
uv.h:722
uv_write
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_run
UV_EXTERN int uv_run(uv_loop_t *, uv_run_mode mode)
Definition:
core.c:365
uv_tty_set_mode
UV_EXTERN int uv_tty_set_mode(uv_tty_t *, uv_tty_mode_t mode)
Definition:
tty.c:250
uv_tty_reset_mode
UV_EXTERN int uv_tty_reset_mode(void)
Definition:
tty.c:378
uv_guess_handle
UV_EXTERN uv_handle_type uv_guess_handle(uv_file file)
Definition:
tty.c:315
uv_tty_init
UV_EXTERN int uv_tty_init(uv_loop_t *, uv_tty_t *, uv_file fd, int readable)
Definition:
tty.c:123
uv_default_loop
UV_EXTERN uv_loop_t * uv_default_loop(void)
Definition:
uv-common.c:763
subprojects
libuv-v1.40.0
docs
code
tty
main.c
Generated by
1.9.1