Ajout doc + suppressions fichier et code inutile
This commit is contained in:
parent
4e372b9223
commit
08a0106190
3 changed files with 2 additions and 68 deletions
|
@ -12,7 +12,8 @@
|
|||
|
||||
/**
|
||||
* get_input(): Permet de récupérer la saisie de l’utilisateur
|
||||
* @user_input: string où sera enregistrée l’entrée de l’utilisateur
|
||||
*
|
||||
* Return: Entrée utilisateur
|
||||
*/
|
||||
char* get_input()
|
||||
{
|
||||
|
|
42
src/shell2.c
42
src/shell2.c
|
@ -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;
|
||||
}
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue