-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory.h
32 lines (30 loc) · 1.02 KB
/
history.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <sys/stat.h>
#include <limits.h>
#include "parse.h"
#include "execute.h"
/**
* @brief Writes a command to the .catsh_history file (where previous commands are stored)
*
* @param command The command to be written to the .catsh_history file
*/
void writeCommandToHistory(char *command);
/**
* @brief Loads in the .catsh_history file (where previous commands are stored) as a char* array
*
*/
void readHistory();
/**
* @brief Prints the previously executed commands from the .catsh_history file that is now stored in the char* array.
*
*/
void printHistory();
/**
* @brief Executes a command that was stored in the .catsh_history file (where previous commands are stored) based on the given array indice corresponding to a previous command in the char* array
*
* @param input The array indice corresponding to a previously executed terminal command that is now stored in .catsh_history and the char* array
*/
void runHistory(char* input);
int historyFile;
char **history;
int historyLength;
char catshDirectory[PATH_MAX];