C-Shell
A simple shell written in C.
Loading...
Searching...
No Matches
terminal.c File Reference

User input handling and terminal manipulation. More...

#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "internal_commands.h"
#include "internal/history.h"
#include "terminal.h"

Data Structures

struct  filter_context
 

Functions

void backspace (size_t n)
 Prints a 'backspace' n times.
 
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.
 

Detailed Description

User input handling and terminal manipulation.

Function Documentation

◆ backspace()

void backspace ( size_t n)

Prints a 'backspace' n times.

◆ 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.