minishell
Minishell Project for École 42
|
Builtin function for the "pwd" command. More...
#include "minishell.h"
Functions | |
int | get_sizeof_args (char **args) |
Retrieves the number of arguments in an array of strings. | |
int | pwd (void) |
Executes the "pwd" command to print the current working directory. | |
Builtin function for the "pwd" command.
This file contains the implementation of the pwd
builtin function for the minishell project. The pwd
command is used to print the current working directory to the standard output.
int get_sizeof_args | ( | char ** | args | ) |
Retrieves the number of arguments in an array of strings.
This function counts the number of elements (arguments) in an array of strings and returns the count.
[in] | args | An array of strings containing command arguments. |
int pwd | ( | void | ) |
Executes the "pwd" command to print the current working directory.
This function gets the current working directory using getcwd() and prints it to the standard output. If successful, it returns EXIT_SUCCESS
; otherwise, it prints an error message and returns EXIT_FAILURE
.