Ajout doc + suppressions fichier et code inutile

This commit is contained in:
rick 2021-02-16 19:36:05 +01:00
parent 4e372b9223
commit 08a0106190
Signed by: Rick
GPG key ID: 2B593F087240EE99
3 changed files with 2 additions and 68 deletions

View file

@ -12,7 +12,8 @@
/**
* get_input(): Permet de récupérer la saisie de lutilisateur
* @user_input: string sera enregistrée lentrée de lutilisateur
*
* Return: Entrée utilisateur
*/
char* get_input()
{

View file

@ -1,42 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include "parser.h"
int main()
{
int result, pid;
char *args[MAX_LENGTH];
for (int i = 0; i < MAX_LENGTH; i++)
args[i] = (char *) calloc(MAX_LENGTH, sizeof(char));
parse_char(args, ' ');
//get_args(args);
while (strcmp(args[0], "exit"))
{
pid = fork();
if (!pid)
{
execvp(args[0], args);
return 0;
}
else
wait(&result);
for (int i = 0; i < MAX_LENGTH; i++)
{
free(args[i]);
args[i] = (char *) calloc(MAX_LENGTH, sizeof(char));
}
//get_args(args);
parse_char(args, ' ');
}
for (int i = 0; i < MAX_LENGTH; i++)
free(args[i]);
return 0;
}

View file

@ -30,29 +30,6 @@ int main()
}
parse_char(args, '|');
/*
int indx = 0;
while (args[indx] != NULL)
{
tok_space(args[indx], command);
int i = 0;
while (command[i] != NULL)
{
printf("- %s - ", command[i]);
i++;
}
for (int i = 0; i < MAX_LENGTH; i++)
{
free(command[i]);
command[i] = (char *) calloc(MAX_LENGTH, sizeof(char));
}
if ( args[indx+1] == NULL )
printf("CASSSSSESESESESISRETNRISUT.NR\n");
indx++;
}
return 0;
*/
int index = 0;
while (strcmp(args[0], "exit"))
@ -86,10 +63,8 @@ int main()
{
close(my_pipe[1]);
close(my_pipe[0]);
//wait(&result);
waitpid(pid, NULL, 0);
}
//waitpid(-1, NULL, 0);
index++;
}
}