mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 03:16:51 +01:00
「🔨」 fix: compilation fixed
This commit is contained in:
@ -1,21 +0,0 @@
|
||||
[
|
||||
{
|
||||
"directory": "/nfs/homes/adjoly/Documents/ft_minipowershell",
|
||||
"arguments": [
|
||||
"cc",
|
||||
"-I",
|
||||
"include/",
|
||||
"-I",
|
||||
"libft/",
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-g",
|
||||
"src/main.c",
|
||||
"-c",
|
||||
"-o",
|
||||
"obj/src/main.o"
|
||||
],
|
||||
"file": "src/main.c"
|
||||
}
|
||||
]
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/26 09:38:51 by mmoussou #+# #+# */
|
||||
/* Updated: 2024/04/29 13:21:45 by mmoussou ### ########.fr */
|
||||
/* Updated: 2024/04/30 12:39:03 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -6,12 +6,18 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 11:53:11 by mmoussou #+# #+# */
|
||||
/* Updated: 2024/04/29 13:51:08 by mmoussou ### ########.fr */
|
||||
/* Updated: 2024/04/30 12:54:48 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
size_t ft_envsize(t_env *env)
|
||||
{
|
||||
(void)env;
|
||||
return (0);
|
||||
}
|
||||
|
||||
char **get_env(t_env *env)
|
||||
{
|
||||
char **exec_env;
|
||||
@ -32,8 +38,8 @@ char **get_env(t_env *env)
|
||||
}
|
||||
ft_strlcpy(exec_env[i], env->name, ft_strlen(env->name));
|
||||
exec_env[i][ft_strlen(env->name)] = '=';
|
||||
ft_strlcpy(exec_env[i] + ft_strlen(env->name) + 1,
|
||||
env->content, ft_strlen(env->content))
|
||||
ft_strlcpy(exec_env[i] + ft_strlen(env->name) + 1, \
|
||||
env->content, ft_strlen(env->content));
|
||||
env = env->next;
|
||||
i++;
|
||||
}
|
||||
|
20
src/main.c
20
src/main.c
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/24 11:18:04 by adjoly #+# #+# */
|
||||
/* Updated: 2024/04/29 13:35:58 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/30 12:40:35 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <fcntl.h>
|
||||
#include "minishell.h"
|
||||
#include "libft.h"
|
||||
|
||||
bool is_str(char *src, char *dst)
|
||||
{
|
||||
@ -31,35 +30,34 @@ bool is_str(char *src, char *dst)
|
||||
return (true);
|
||||
}
|
||||
|
||||
char *get_hostname(void)
|
||||
/*char *get_hostname(void)
|
||||
{
|
||||
char *hostname;
|
||||
char *tmp;
|
||||
int host_file;
|
||||
|
||||
host_file = open();
|
||||
read();
|
||||
//host_file = open();
|
||||
tmp = hostname;
|
||||
while (*tmp)
|
||||
tmp++;
|
||||
return
|
||||
}
|
||||
}*/
|
||||
|
||||
char *get_prompt(void)
|
||||
{
|
||||
char **prompt;
|
||||
char *ret;
|
||||
char *ret = NULL;
|
||||
char *home;
|
||||
char **tmp;
|
||||
|
||||
prompt = malloc(1000);
|
||||
prompt[0] = getenv("USER");
|
||||
prompt[1] = "@";
|
||||
prompt[2] = get_hostname();
|
||||
//prompt[2] = get_hostname();
|
||||
home = getenv("HOME");
|
||||
prompt[3] = getenv("PWD");
|
||||
prompt[4] = ">";
|
||||
ret = ft_calloc(1000, sizeof(char));
|
||||
//ret = ft_calloc(1000, sizeof(char));
|
||||
|
||||
if (!ft_strncmp(prompt[3], home, ft_strlen(home)))
|
||||
prompt[3] += ft_strlen(home);
|
||||
@ -77,7 +75,7 @@ int main(int ac, char **av, char **env)
|
||||
{
|
||||
char *test;
|
||||
char **lll;
|
||||
char *ret;
|
||||
char *ret = NULL;
|
||||
|
||||
(void)ac;
|
||||
(void)av;
|
||||
@ -94,6 +92,6 @@ int main(int ac, char **av, char **env)
|
||||
if (is_str(test, "exit"))
|
||||
break;
|
||||
}
|
||||
ft_freearr((void **)lll);
|
||||
//ft_freearr((void **)lll);
|
||||
return (0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user