의 미러
https://gitlab.com/klmp200/fish.git
synced 2025-07-11 12:19:23 +00:00
Très pratique fonction de crash
This commit is contained in:
@ -62,8 +62,7 @@ WordArray * split(char *string, char *separator){
|
||||
}
|
||||
|
||||
if (tokens == NULL || to_delete == NULL || tokens->words == NULL){
|
||||
fprintf(stderr, "fish: Error allocating fucking pointer !");
|
||||
exit(EXIT_FAILURE);
|
||||
crash();
|
||||
}
|
||||
|
||||
while((token = strsep(&to_delete, separator)) != NULL){
|
||||
@ -95,8 +94,7 @@ char *fishReadLine() {
|
||||
int c;
|
||||
|
||||
if (line == NULL){
|
||||
fprintf(stderr, "fish: Error allocating fucking buffer shit !");
|
||||
exit(EXIT_FAILURE);
|
||||
crash();
|
||||
}
|
||||
|
||||
while (1){
|
||||
@ -118,8 +116,7 @@ char *fishReadLine() {
|
||||
bufferSize+=bufferSize;
|
||||
line = realloc(line, bufferSize);
|
||||
if (line == NULL){
|
||||
fprintf(stderr, "fish: Error allocating fucking buffer shit !");
|
||||
exit(EXIT_FAILURE);
|
||||
crash();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,8 +132,7 @@ char *fishExpand(char *line) {
|
||||
Settings *getSettings() {
|
||||
Settings *s = (Settings*) malloc(sizeof(Settings));
|
||||
if (s == NULL){
|
||||
fprintf(stderr, "fish: Error allocating fucking settings");
|
||||
exit(EXIT_FAILURE);
|
||||
crash();
|
||||
}
|
||||
s->PS1 = strdup("\n~>");
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "fish_types.h"
|
||||
#include "fish_commands.h"
|
||||
#include "fish_utils.h"
|
||||
|
||||
/* WordArray functions */
|
||||
|
||||
|
11
fish_shell/fish_utils.c
Normal file
11
fish_shell/fish_utils.c
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// Created by Antoine Bartuccio on 15/05/2017.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void crash(){
|
||||
fprintf(stderr, "fish: Error allocating fucking pointer !");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
10
fish_shell/fish_utils.h
Normal file
10
fish_shell/fish_utils.h
Normal file
@ -0,0 +1,10 @@
|
||||
//
|
||||
// Created by Antoine Bartuccio on 15/05/2017.
|
||||
//
|
||||
|
||||
#ifndef FISH_FISH_UTILS_H
|
||||
#define FISH_FISH_UTILS_H
|
||||
|
||||
void crash();
|
||||
|
||||
#endif //FISH_FISH_UTILS_H
|
Reference in New Issue
Block a user