Patching the fucking pwd
This commit is contained in:
parent
c5a06ce9df
commit
45bacdd3c0
3 changed files with 11 additions and 5 deletions
4
Makefile
4
Makefile
|
|
@ -6,7 +6,7 @@
|
|||
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||
# Updated: 2024/08/12 17:05:19 by maiboyer ### ########.fr #
|
||||
# Updated: 2024/08/12 17:53:35 by rparodi ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ endif
|
|||
endif
|
||||
|
||||
# TODO: ADD THIS WHEN FINISHING THIS:
|
||||
# CFLAGS_ADDITIONAL += -DNVALGRIND
|
||||
CFLAGS_ADDITIONAL += -DNVALGRIND
|
||||
CFLAGS_ADDITIONAL += -O0 -Wno-cpp
|
||||
|
||||
# TODO: REMOVE THIS WHEN FINISHING THIS:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/07 14:22:50 by rparodi #+# #+# */
|
||||
/* Updated: 2024/08/11 12:49:51 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/08/12 14:16:45 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/07 13:58:37 by rparodi #+# #+# */
|
||||
/* Updated: 2024/08/11 11:26:12 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/08/12 18:14:08 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
#include "me/mem/mem.h"
|
||||
#include "me/string/string.h"
|
||||
#include "me/types.h"
|
||||
#include <errno.h>
|
||||
|
||||
t_error builtin_pwd___(t_state *state, t_builtin_spawn_info info, t_i32 *exit_code)
|
||||
{
|
||||
|
|
@ -21,7 +22,12 @@ t_error builtin_pwd___(t_state *state, t_builtin_spawn_info info, t_i32 *exit_co
|
|||
|
||||
s = string_new(1024);
|
||||
while (getcwd(s.buf, s.capacity - 1) == NULL)
|
||||
string_reserve(&s, s.capacity * 2);
|
||||
{
|
||||
if (errno == ERANGE)
|
||||
string_reserve(&s, s.capacity * 3);
|
||||
else
|
||||
return (string_free(s), ERROR);
|
||||
}
|
||||
printf("%s\n", s.buf);
|
||||
string_free(s);
|
||||
return (*exit_code = 0, NO_ERROR);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue