MiniDevil As beautiful as a shell
builtin_pwd.c
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* builtin_pwd.c :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: baelgadi <baelgadi@student.42.fr> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2025/12/11 06:07:41 by baelgadi #+# #+# */
9 /* Updated: 2026/03/04 04:37:24 by baelgadi ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #include <stdio.h>
14 #include "builtins.h"
15 #include "libft.h"
16 
24 int builtin_pwd(void)
25 {
26  char cwd[PATH_MAX];
27 
28  if (!getcwd(cwd, PATH_MAX))
29  {
30  perror("minishell: pwd");
31  return (1);
32  }
33  ft_putendl_fd(cwd, STDOUT_FILENO);
34  return (0);
35 }
int builtin_pwd(void)
Implement the pwd command.
Definition: builtin_pwd.c:24
Shell builtin commands prototypes.