#define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if 1 #include "platform.h" #define FALSE 0 #define TRUE 1 #define smallint int // #define KEYCODE_BUFFER_SIZE 16 struct globals *ptr_to_globals; #define SET_PTR_TO_GLOBALS(x) ptr_to_globals = (x) #define xzalloc malloc #define xstrndup strndup #define xstrdup strdup #define xmalloc malloc #define xrealloc realloc #define xfree free #define bb_putchar putchar #define bb_perror_msg perror // #define bb_error_msg_and_die(...) exit((fprintf(stderr, __VA_ARGS__)&0)|(EXIT_FAILURE)) #define ssize_t size_t #define FAST_FUNC #define NOINLINE #include "keycodes.h" #define TERMIOS_RAW_CRNL (1 << 1) #define TERMIOS_CLEAR_ISIG (1 << 0) #define TERMIOS_RAW_INPUT (1 << 2) #define ARRAY_SIZE(x) ((unsigned)((sizeof(x)) / (sizeof(x[0])))) #define LOGMODE_STDIO 0 extern const char *applet_name; #if 1 int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *height); int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout); int FAST_FUNC set_termios_to_raw(int fd, struct termios *oldterm, int flags); int FAST_FUNC tcsetattr_stdin_TCSANOW(const struct termios *tp); int safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout_ms) FAST_FUNC; void FAST_FUNC bb_error_msg_and_die(const char *s, ...); ssize_t FAST_FUNC full_read(int fd, void *buf, size_t len); ssize_t FAST_FUNC full_write(int fd, const void *buf, size_t len); static int wh_helper(int value, int def_val, const char *env_name, int *err); ssize_t FAST_FUNC safe_write(int fd, const void *buf, size_t count); ssize_t FAST_FUNC safe_read(int fd, void *buf, size_t count); void xfunc_die(); #endif #endif #define ENABLE_FEATURE_EDITING_ASK_TERMINAL 1 #define ENABLE_FEATURE_VI_ASK_TERMINAL 1 #define ENABLE_FEATURE_LESS_ASK_TERMINAL 1