This commit is contained in:
Loic Deridder
2025-01-14 14:02:16 +01:00
parent 2bd971c726
commit e47ba2f8f8
11 changed files with 129 additions and 3 deletions

20
srcs/builtins/pwd.c Normal file
View File

@@ -0,0 +1,20 @@
#include "../../includes/builtins.h"
void builtin_pwd(char *arg)
{
char *cwd;
if (ft_strlen(arg) > 3)
ft_putendl_fd("pwd: too many arguments", 2);
else
{
cwd = getcwd(NULL, 4096);
if (cwd != NULL)
{
printf("%s\n", cwd);
free(cwd);
}
if (!cwd)
perror("pwd");
}
}