CNDP
22.08.0
|
#include <termios.h>
#include <signal.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <cne_atomic.h>
#include <cne_common.h>
#include <cne_system.h>
Go to the source code of this file.
Data Structures | |
struct | cne_tty_t |
Functions | |
CNDP_API int | tty_setup (int fd_in, int fd_out) |
CNDP_API void | tty_destroy (void) |
CNDP_API void | tty_enable_color (void) |
CNDP_API void | tty_disable_color (void) |
CNDP_API int | tty_is_color_on (void) |
CNDP_API int | tty_is_inited (void) |
CNDP_API void | tty_set_wchanged (void) |
CNDP_API void | tty_clear_wchanged (void) |
CNDP_API int | tty_did_wchange (void) |
CNDP_API tty_wsize_t * | tty_window_size (void) |
CNDP_API int | tty_num_rows (void) |
CNDP_API int | tty_num_columns (void) |
CNDP_API int | tty_poll (char *buf, int len, int timeout) |
CNDP_API int | tty_write (const char *buf, int len) |
CNDP_API int | tty_dwrite (int fd, const char *buf, int len) |
CNDP_API int | tty_fwrite (FILE *f, const char *buf, int len) |
CNDP_API int | tty_read (char *buf, int len) |
CNDP_API int | tty_dread (int fd, char *buf, int len) |
CNDP_API int | tty_fread (FILE *f, char *buf, int len) |
CNDP_API int | tty_printf (const char *fmt,...) |
CNDP_API int | tty_fprintf (FILE *f, const char *fmt,...) |
CNDP_API int | tty_vprintf (const char *fmt, va_list ap) |
CNDP_API int | tty_vfprintf (FILE *f, const char *fmt, va_list ap) |
CNE TTY input and output support routines.
Setup the TTY for I/O unless it is a socket instead. These routines are used by cli and all output routines for stdin/stdout as well as socket I/O handling.
Definition in file cne_tty.h.
CNDP_API int tty_setup | ( | int | fd_in, |
int | fd_out | ||
) |
setup a tty or socket for user input. Default is stdin/stdout
fd_in | Set the tty input file descriptor, if -1 use STDIN_FILENO |
fd_out | Set the tty output file descriptor, if -i use STDOUT_FILENO |
CNDP_API void tty_destroy | ( | void | ) |
Destroy or cleanup the tty interface and handlers
CNDP_API void tty_enable_color | ( | void | ) |
Enable color printing of messages.
CNDP_API void tty_disable_color | ( | void | ) |
Disable color printing of messages.
CNDP_API int tty_is_color_on | ( | void | ) |
Test to see if color output is enabled or disabled.
CNDP_API int tty_is_inited | ( | void | ) |
Has the TTY been inited?
CNDP_API void tty_set_wchanged | ( | void | ) |
Set the window size changed flag.
CNDP_API void tty_clear_wchanged | ( | void | ) |
Clear the window size changed flag.
CNDP_API int tty_did_wchange | ( | void | ) |
Test if the window size has changed.
Flag is cleared when read.
CNDP_API tty_wsize_t* tty_window_size | ( | void | ) |
Get the current window size
CNDP_API int tty_num_rows | ( | void | ) |
Return the number of rows in the screen
CNDP_API int tty_num_columns | ( | void | ) |
Return the number of columns in the screen
CNDP_API int tty_poll | ( | char * | buf, |
int | len, | ||
int | timeout | ||
) |
Poll the TTY input fd and return number of bytes read
buf | Buffer to put the input characters |
len | The length of the buf array |
timeout | The number of milli-seconds to wait or -1 for no timeout |
CNDP_API int tty_write | ( | const char * | buf, |
int | len | ||
) |
Write the data from buf to the tty file descriptor.
buf | Pointer to data buffer to output the file descriptor. |
len | Number of bytes to write to file descriptor. |
CNDP_API int tty_dwrite | ( | int | fd, |
const char * | buf, | ||
int | len | ||
) |
Write the data from buf to the tty file descriptor number, bypass this_tty->fd_out
fd | The file descriptor index value |
buf | Pointer to data buffer to output the file descriptor. |
len | Number of bytes to write to file descriptor. |
CNDP_API int tty_fwrite | ( | FILE * | f, |
const char * | buf, | ||
int | len | ||
) |
Write the data from buf to the tty file descriptor, bypass this_tty->fd_out
f | The file descriptor pointer |
buf | Pointer to data buffer to output the file descriptor. |
len | Number of bytes to write to file descriptor. |
CNDP_API int tty_read | ( | char * | buf, |
int | len | ||
) |
Read the data from the tty file descriptor into the buffer.
buf | Pointer to data buffer to place the input from file descriptor. |
len | Number of bytes to read from file descriptor. |
CNDP_API int tty_dread | ( | int | fd, |
char * | buf, | ||
int | len | ||
) |
Read the data from the tty file descriptor into the buffer.
fd | The file descriptor index value |
buf | Pointer to data buffer to place the input from file descriptor. |
len | Number of bytes to read from file descriptor. |
CNDP_API int tty_fread | ( | FILE * | f, |
char * | buf, | ||
int | len | ||
) |
Read the data from the tty file descriptor into the buffer.
f | The file descriptor pointer |
buf | Pointer to data buffer to place the input from file descriptor. |
len | Number of bytes to read from file descriptor. |
CNDP_API int tty_printf | ( | const char * | fmt, |
... | |||
) |
A printf like routine to output to tty file descriptor.
fmt | The formatting string for a printf like API |
CNDP_API int tty_fprintf | ( | FILE * | f, |
const char * | fmt, | ||
... | |||
) |
A fprintf like routine to output to tty file descriptor.
f | The file descriptor pointer |
fmt | The formatting string for a printf like API |
CNDP_API int tty_vprintf | ( | const char * | fmt, |
va_list | ap | ||
) |
A vprintf like routine to output to tty file descriptor
fmt | The cne_printf() like format string. |
ap | The va_list pointer |
CNDP_API int tty_vfprintf | ( | FILE * | f, |
const char * | fmt, | ||
va_list | ap | ||
) |
A vfprintf like routine to output to tty file descriptor
f | The file descriptor pointer |
fmt | The cne_printf() like format string. |
ap | The va_list pointer |