This header file contains almost everything needed for this project.
More...
Go to the source code of this file.
|
int | execute (int nargs, char *command, char **args) |
| Executes the command.
|
|
int | load_settings () |
| Will load configuration file(s).
|
|
int | loop () |
| I keep looping, looping till the user exits.
|
|
char ** | parse_line (char *line, size_t line_size, int *nargs) |
| Tokenizes the line.
|
|
int | print_prompt () |
| Prints username@machinename.
|
|
int | read_line (char *buffer, int buffer_size) |
| Reads a line from stdin.
|
|
This header file contains almost everything needed for this project.
- Author
- Swastik Pal
- Version
- 0.1
- Date
- 2022-11-03
◆ C_SHELL_TOK_DELIM
#define C_SHELL_TOK_DELIM " \t\r\n" |
◆ cls
#define cls printf("\033[2J\033[1;1H"); |
◆ LINE_BUFFER_SIZE
#define LINE_BUFFER_SIZE 1024 |
◆ MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 32 |
◆ execute()
int execute |
( |
int | nargs, |
|
|
char * | command, |
|
|
char ** | args ) |
Executes the command.
- Parameters
-
nargs | Number of arguments to the command. |
command | The command to execute. |
args | The list of arguments to the command. |
- Returns
- int
Available commands:
- cls - clears the screen
- exit - terminates the terminal
◆ load_settings()
Will load configuration file(s).
Not yet implemented.
◆ loop()
I keep looping, looping till the user exits.
◆ parse_line()
char ** parse_line |
( |
char * | line, |
|
|
size_t | line_size, |
|
|
int * | nargs ) |
Tokenizes the line.
- Parameters
-
line | A string. |
line_size | Length of the string. |
- Returns
- char** An array of tokens.
◆ print_prompt()
Prints username@machinename.
◆ read_line()
int read_line |
( |
char * | buffer, |
|
|
int | buffer_size ) |
Reads a line from stdin.
- Parameters
-
buffer | The buffer to write into. |
buffer_size | The size of the provided buffer. |
- Returns
- int The number of characters read.