This commit is contained in:
mcolonna 2024-07-03 14:10:44 +02:00
parent 6862a1913b
commit 75150f95dd
2 changed files with 5 additions and 6 deletions

View file

@ -6,15 +6,15 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */ /* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 13:43:21 by mcolonna #+# #+# */ /* Created: 2024/06/27 13:43:21 by mcolonna #+# #+# */
/* Updated: 2024/07/03 11:34:12 by mcolonna ### ########.fr */ /* Updated: 2024/07/03 14:09:27 by mcolonna ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef VARIABLES_H #ifndef VARIABLES_H
# define VARIABLES_H # define VARIABLES_H
# define SYMBOL_CHARS \ # define SYMBOL_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789" _0123456789"
typedef struct s_variable typedef struct s_variable
{ {

View file

@ -6,7 +6,7 @@
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */ /* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/25 13:28:29 by jschaft #+# #+# */ /* Created: 2024/06/25 13:28:29 by jschaft #+# #+# */
/* Updated: 2024/07/03 12:16:48 by mcolonna ### ########.fr */ /* Updated: 2024/07/03 14:06:04 by mcolonna ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -75,10 +75,9 @@ int cd_builtin(t_env *env, t_call call, int std[2])
{ {
int r; int r;
const char *pwd; const char *pwd;
bool go_oldpwd; const bool go_oldpwd = call.argv[1] && str_eq(call.argv[1], "-");
(void)std; (void)std;
go_oldpwd = call.argc > 1 && str_eq(call.argv[1], "-");
if (call.argc == 1 || go_oldpwd) if (call.argc == 1 || go_oldpwd)
pwd = go_home(env, go_oldpwd); pwd = go_home(env, go_oldpwd);
else if (call.argc == 2) else if (call.argc == 2)