1
0
의 미러 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:
2017-05-15 14:08:10 +02:00
부모 a826969c3e
커밋 4228071f6d
5개의 변경된 파일27개의 추가작업 그리고 9개의 파일을 삭제

파일 보기

@ -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
파일 보기

@ -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
파일 보기

@ -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