diff --git a/fish_shell/fish_utils.c b/fish_shell/fish_utils.c index 9ee8560..a018a8f 100644 --- a/fish_shell/fish_utils.c +++ b/fish_shell/fish_utils.c @@ -5,13 +5,42 @@ #include #include #include +#include #include "fish_types.h" void crash(){ - fprintf(stderr, "fish: Error allocating fucking pointer !"); + char *crashErrors[] = { + "fish: Fucking malloc always returning NULL pointer !", + "fish: Error allocating fucking pointer !", + "fish: C language exploding again", + "fish: It's not you're fault for this time" + }; + int picked = 0; + + srand((unsigned int) time(NULL)); + picked = rand() % (sizeof(crashErrors) / sizeof(char*)); + + fprintf(stderr, "%s\n", crashErrors[picked]); exit(EXIT_FAILURE); } +char *getInsult(){ + static int init = 0; + int picked = 0; + char *insults[] = { + "Apprend à écrire crétin !", + "Bolos !", + "Mois aussi je sais écrire de la merde, pourtant je le fait pas !" + }; + if (!init){ + srand((unsigned int) time(NULL)); + init = 1; + } + + picked = rand() % (sizeof(insults) / sizeof(char*)); + return insults[picked]; +} + void freeWordArray(WordArray *array) { int i; if (array != NULL) { diff --git a/fish_shell/fish_utils.h b/fish_shell/fish_utils.h index 84ddbea..70e3725 100644 --- a/fish_shell/fish_utils.h +++ b/fish_shell/fish_utils.h @@ -9,6 +9,8 @@ void crash(); +char *getInsult(); + void freeWordArray(WordArray *array); WordList * createWordList();