C-Shell
A simple shell written in C.
Loading...
Searching...
No Matches
terminal.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <termios.h>

Macros

#define cls   printf("\033[2J\033[1;1H");
 
#define MAX_TAB_COMPLETION_ENTRIES   5
 

Functions

size_t read_line (char *buffer, size_t buffer_size)
 Reads a line from stdin.
 
int set_term_flag (int term_des, tcflag_t flag, bool set)
 Sets a terminal flag.
 

Macro Definition Documentation

◆ cls

#define cls   printf("\033[2J\033[1;1H");

Clears the screen. Requires terminal support for ANSI escape sequences.

◆ MAX_TAB_COMPLETION_ENTRIES

#define MAX_TAB_COMPLETION_ENTRIES   5

Function Documentation

◆ read_line()

size_t read_line ( char * buffer,
size_t buffer_size )

Reads a line from stdin.

Parameters
bufferThe buffer to write into.
buffer_sizeThe size of the provided buffer.
Returns
The number of characters read.

◆ set_term_flag()

int set_term_flag ( int term_des,
tcflag_t flag,
bool set )

Sets a terminal flag.

Parameters
term_desThe terminal descriptor.
flagThe flag to modify.
setWhether to set or unset the flag.
Returns
0 on success.