mirror of
https://gitlab.com/klmp200/fish.git
synced 2024-12-29 11:11:09 +00:00
Messages d'erreur aléatoires
This commit is contained in:
parent
b8735666e0
commit
9a6020d97c
@ -5,13 +5,42 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#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) {
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
void crash();
|
||||
|
||||
char *getInsult();
|
||||
|
||||
void freeWordArray(WordArray *array);
|
||||
|
||||
WordList * createWordList();
|
||||
|
Loading…
Reference in New Issue
Block a user