1
0
mirror of https://gitlab.com/klmp200/fish.git synced 2024-11-21 16:23:20 +00:00

"cd" now works without arguments, added README

This commit is contained in:
Aethor 2017-06-07 18:56:22 +02:00
parent 1b99d6cfe5
commit c22c3949c2

View File

@ -6,6 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "fish_core.h" #include "fish_core.h"
#include "fish_types.h" #include "fish_types.h"
#include "fish_settings.h"
/* Necessary global variables */ /* Necessary global variables */
char * builtinCommandsStr[] = { char * builtinCommandsStr[] = {
@ -32,8 +33,16 @@ builtinCommand **getBuiltinCommands(){
int fishCd(WordArray *args) { int fishCd(WordArray *args) {
if (args->size < 2){ if (args->size < 2){
fprintf(stderr, "fish: Où sont les arguments de ta commande \"cd\" connard ?!\n"); //fprintf(stderr, "fish: Où sont les arguments de ta commande \"cd\" connard ?!\n");
return EXIT_FAILURE; Settings* settings = getSettings();
if(chdir(settings->passwd->pw_dir) != 0){
perror("fish");
return EXIT_FAILURE;
}
freeSettings(settings);
//return EXIT_SUCCESS;
} else { } else {
if (chdir(args->words[1]) != 0){ if (chdir(args->words[1]) != 0){
perror("fish"); perror("fish");