maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
pwd.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* pwd.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: dmdemirk <dmdemirk@student.42london.c +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2024/06/17 11:10:33 by dmdemirk #+# #+# */
9
/* Updated: 2024/09/06 12:01:53 by dmdemirk ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "
shell.h
"
14
#include <unistd.h>
15
#include "
libft.h
"
16
#include <stdio.h>
17
#include "
exit_status.h
"
18
19
/*
20
Functionality:
21
- Print the current working directory
22
*/
23
24
int
builtin_pwd
(
t_ms_data
*data)
25
{
26
char
cwd[4096];
27
28
(void)data;
29
if
(getcwd(cwd,
sizeof
(cwd)) != NULL)
30
ft_putendl_fd
(cwd, STDOUT_FILENO);
31
return
(
EXIT_SUCCESS
);
32
}
exit_status.h
EXIT_SUCCESS
#define EXIT_SUCCESS
Definition
exit_status.h:16
libft.h
ft_putendl_fd
void ft_putendl_fd(char *s, int fd)
Definition
ft_putendl_fd.c:21
builtin_pwd
int builtin_pwd(t_ms_data *data)
Definition
pwd.c:24
shell.h
s_ms_data
Definition
shell.h:21
src
builtins
pwd.c
Generated by
1.9.8