1
0
mirror of https://gitlab.com/klmp200/fish.git synced 2024-12-22 07:41:08 +00:00

Commentaires

This commit is contained in:
Antoine Bartuccio 2017-06-19 13:45:06 +02:00
parent 3eea812666
commit 46d99e6836
5 changed files with 47 additions and 1 deletions

View File

@ -8,7 +8,7 @@
#include "fish_types.h"
#include "fish_settings.h"
/* Necessary global variables */
/* Necessary global variable */
char * builtinCommandsStr[] = {
(char *) "clear",
(char *) "kek",
@ -17,6 +17,7 @@ char * builtinCommandsStr[] = {
(char *) "exit"
};
/* Necessary global variable */
builtinCommand *builtinCommands[] = {
&fishClear,
&fishKek,

View File

@ -9,22 +9,33 @@
/* Getters */
/* Getter for global variable in external files */
char ** getBuiltinCommandsStr ();
/* Getter for global variable in external files */
builtinCommand **getBuiltinCommands();
/* Get size of the two global variable array */
int getNbBuiltins();
/* Built in shell commands */
/* Change Dir internal command */
int fishCd(WordArray * args);
/* Help internal command */
int fishHelp(WordArray * args);
/* Exit internal command */
int fishExit(WordArray * args);
/* Kek internal command */
int fishKek(WordArray *args);
/* Clear the terninal (internal command) */
int fishClear(WordArray *args);
/* Handle signal from the user (such as ctrl+c */
void fishSignalHandler(int s);
#endif //FISH_FISH_COMMANDS_H

View File

@ -23,18 +23,25 @@ WordList * split(char *string, char *separator); // Tested
/* General purpose functions */
/* Main loop of the project */
void fishLoop(Settings * settings);
/* Get the user input */
char * fishReadLine();
/* Count the number of occurrences of a given regex pattern */
int countSeparators(char *string, char *regex); // Tested
/* Execute an external command */
int fishLoad(WordArray *array);
/* Handle operators in the user input */
int fishExecute(WordList *list);
/* Cut a WordList at the given operator regex pattern */
WordList *parseWordList(WordList *list, shell_operator *an_operator);
/* Choose between internal and external command */
int loadRightCommand(WordArray *array);
/* IN/OUT functions */

View File

@ -6,9 +6,16 @@
#define FISH_RC_FILE "/.fishrc"
#define FISH_RC_FILE_SIZE 8
/* Get settings */
Settings * getSettings(); //TESTEDssssss
/* Free settings */
void freeSettings(Settings *settings); //TESTED
/* Extract a given variable from a given file */
char* extractVariable(char* filename, char* var);//TESTED
/* Correctly print PS1 and PS2 variable */
void printPS(char* PS, Settings* s);
#endif //FISH_FISH_SETTINGS_H

View File

@ -7,42 +7,62 @@
#include "fish_types.h"
/* Crash the application and throw a random error message in english */
void crash(); // Tested
/* Get a random french insult for the user */
char *getInsult(); // Tested
/* Free a WordArray */
void freeWordArray(WordArray *array); // Tested
/* Create a new WordList */
WordList * createWordList(); // Tested
/* Cut a WordList and throw every word contained between the two index */
WordList * sliceWordList(WordList *list, int min_index, int max_index);
/* Add a world at the end of a WordList */
void addEndWordList(WordList *list, char *word); // Tested
/* Add a word at the beginning of a WordList */
void addBeginWordList(WordList *list, char *word);
/* Delete an entire WordList */
void removeWordList(WordList *list); // Tested
/* Remove an element from a WordList */
void removeWordListElem(WordList *list, WordListElement *elem);
/* Free an entire WordList */
void freeWordList(WordList *list); // Tested
/* Convert a WordList into a WordArray */
WordArray * wordListToWordArray(WordList *list); // Tested
/* Convert a WordArray into a WordList */
WordList * wordArrayToWordList(WordArray * array); // Tested
/* Split a WordList according to a given regex */
WordList * splitWordList(WordList *list, char *regex);
/* Split a word from a given index removing parts according to the size to delete */
char * splitWord(char * origin, int beginning_index, int size_to_delete); // Tested
/* Put the second WordList into the first one */
void concatWordList(WordList* list1, WordList* list2);
/* Print a WordList for debug */
void printWordList(WordList* list);
/* Detect if a string contains a given character */
int stringContains(char* string, char charToTest);
/* Better than Strcat */
char* trueStrcat(char* string1, char* string2);
/* Check if the given path is a directory */
int isDirectory(char* path);