Merge branch 'mylan2' into mylan
This commit is contained in:
commit
24d8b38510
43 changed files with 1395 additions and 17 deletions
|
|
@ -6,13 +6,13 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/23 15:03:23 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/23 15:56:21 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/24 13:19:42 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "include.h"
|
||||
|
||||
const char *ask_command(t_memclass mc)
|
||||
const char *ask_command(const t_memclass mc)
|
||||
{
|
||||
const char *r;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/23 15:51:56 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/23 15:56:49 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/24 13:20:31 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
50
src/main.c
50
src/main.c
|
|
@ -6,27 +6,71 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/23 14:33:45 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/23 16:00:53 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/24 13:24:10 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "include.h"
|
||||
|
||||
int main(void)
|
||||
// Clean the screen (TODO)
|
||||
static void execclear(void)
|
||||
{
|
||||
}
|
||||
|
||||
// Print hi :D
|
||||
static void print_hi(void)
|
||||
{
|
||||
printf("Welcome to____________________________________\n");
|
||||
printf("|| ___ ___ ||\n");
|
||||
printf("|| | \\ / | ||\n");
|
||||
printf("|| | |\\ \\ / /| | __ __ __ __ ||\n");
|
||||
printf("|| | | \\ \\ / / | | |__| ||\\ || |__| ||\n");
|
||||
printf("|| | | \\ \\/ / | | __ || \\ || __ ||\n");
|
||||
printf("|| | | \\ / | | || || \\ || || ||\n");
|
||||
printf("|| | | \\/ | | || || \\ || || ||\n");
|
||||
printf("|| | | | | || || \\ || || ||\n");
|
||||
printf("|| |_| |_| || || \\|| || ||\n");
|
||||
printf("|| _____ ||\n");
|
||||
printf("|| / ___| By: Mylan COLONNA ||\n");
|
||||
printf("|| \\ \\ And: Joris SCHAFT ||\n");
|
||||
printf("|| \\ \\ ||\n");
|
||||
printf("|| \\ \\ __ __ __ __ __ ||\n");
|
||||
printf("|| \\ \\ || || ||=== || || ||\n");
|
||||
printf("|| \\ \\ || || || || || ||\n");
|
||||
printf("|| / / ||===|| ||=== || || ||\n");
|
||||
printf("|| ___/ / || || || || || ||\n");
|
||||
printf("|| |____/ || || ||=== ||=== ||=== ||\n");
|
||||
printf("|_____________________________________________|\n\n");
|
||||
}
|
||||
|
||||
int main(const int argc, const char *argv[], const char *envp[])
|
||||
{
|
||||
const char **path = get_path(envp);
|
||||
t_memclass mc;
|
||||
const char *command_str;
|
||||
t_command command;
|
||||
int errorstatus;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
(void)path;
|
||||
(void)command;
|
||||
execclear();
|
||||
print_hi();
|
||||
errorstatus = 0;
|
||||
while (true)
|
||||
{
|
||||
mc = mem_newclass(minishell_error);
|
||||
command = parse_command(ask_command(mc));
|
||||
command_str = ask_command(mc);
|
||||
print_str(minishell_error, 1, "command: ");
|
||||
print_line(minishell_error, 1, command_str);
|
||||
/*
|
||||
command = parse_command(command_str);
|
||||
if (command.error)
|
||||
continue ;
|
||||
errorstatus = execute_command(command);
|
||||
mem_freeall(mc);
|
||||
*/
|
||||
}
|
||||
return (errorstatus);
|
||||
}
|
||||
|
|
|
|||
28
src/path.c
Normal file
28
src/path.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* path.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/16 12:07:26 by jschaft #+# #+# */
|
||||
/* Updated: 2024/04/24 13:26:41 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "include.h"
|
||||
|
||||
const char **get_path(const char **envp)
|
||||
{
|
||||
int i;
|
||||
char **re;
|
||||
char *path;
|
||||
|
||||
i = 0;
|
||||
while (ft_strncmp(envp[i], "PATH=", 5) != 0)
|
||||
i++;
|
||||
path = ft_substr(envp[i], 5, ft_strlen(envp[i]) - 5);
|
||||
re = ft_split(path, ':');
|
||||
free(path);
|
||||
return ((const char **)re);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue