diff --git a/42sh/Makefile b/42sh/Makefile index 9c204824..a1ff1d98 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -84,6 +84,7 @@ exec/redirect_less.c\ exec/redirect_lessand.c\ exec/set_exitstatus.c\ glob/dir_glob.c\ +glob/esc_print.c\ glob/expand_brace.c\ glob/expand_esc.c\ glob/expand_var.c\ diff --git a/42sh/includes/glob.h b/42sh/includes/glob.h index 798b417b..56d25818 100644 --- a/42sh/includes/glob.h +++ b/42sh/includes/glob.h @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/04 16:31:18 by wescande #+# #+# */ -/* Updated: 2017/02/08 13:54:57 by wescande ### ########.fr */ +/* Updated: 2017/02/17 15:42:09 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -51,6 +51,7 @@ typedef struct s_expand */ char **glob(char *str, unsigned char *esc, unsigned char *dbl_esc); +void esc_print(char *str, unsigned char *esc); /* ** return TRUE if path file is a directory. diff --git a/42sh/src/exec/exec_pipe.c b/42sh/src/exec/exec_pipe.c index cd454b9b..833138c3 100644 --- a/42sh/src/exec/exec_pipe.c +++ b/42sh/src/exec/exec_pipe.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 21:13:23 by jhalford #+# #+# */ -/* Updated: 2017/01/09 16:19:38 by jhalford ### ########.fr */ +/* Updated: 2017/02/17 14:36:28 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/glob/esc_print.c b/42sh/src/glob/esc_print.c new file mode 100644 index 00000000..0a5c9f60 --- /dev/null +++ b/42sh/src/glob/esc_print.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* esc_print.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2017/02/17 15:38:14 by jhalford #+# #+# */ +/* Updated: 2017/02/17 15:44:48 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "glob.h" + +void esc_print(char *str, unsigned char *esc) +{ + char *cur; + + cur = str; + while (*cur) + { + if (is_char_esc(esc,str,cur)) + printf("\\%c", *cur); + else + printf("%c", *cur); + ++cur; + } + printf("\n"); +} + diff --git a/42sh/src/glob/is_char_esc.c b/42sh/src/glob/is_char_esc.c index ef702e69..08c99318 100644 --- a/42sh/src/glob/is_char_esc.c +++ b/42sh/src/glob/is_char_esc.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/27 18:19:55 by wescande #+# #+# */ -/* Updated: 2017/02/07 16:33:47 by wescande ### ########.fr */ +/* Updated: 2017/02/17 15:45:15 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/expand_bquotes.c b/42sh/src/lexer/expand_bquotes.c index 73d70160..d2361877 100644 --- a/42sh/src/lexer/expand_bquotes.c +++ b/42sh/src/lexer/expand_bquotes.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/11 16:46:27 by jhalford #+# #+# */ -/* Updated: 2017/02/09 20:45:08 by jhalford ### ########.fr */ +/* Updated: 2017/02/17 15:48:39 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_bquote.c b/42sh/src/lexer/lexer_bquote.c index e5e468dd..0ffbc04e 100644 --- a/42sh/src/lexer/lexer_bquote.c +++ b/42sh/src/lexer/lexer_bquote.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 22:03:48 by jhalford #+# #+# */ -/* Updated: 2017/02/09 22:07:04 by jhalford ### ########.fr */ +/* Updated: 2017/02/17 15:36:49 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,7 +20,7 @@ int lexer_bquote(t_list **alst, t_lexer *lexer) token = (*alst)->content; token->type = TK_WORD; if (lexer->state == DQUOTE_BQUOTE) - token_append(token, lexer, 1, 1); + token_append(token, lexer, 1, 0); else token_append(token, lexer, 0, 0); if (lexer->str[lexer->pos] == '`') diff --git a/42sh/src/lexer/lexer_dquote.c b/42sh/src/lexer/lexer_dquote.c index 5dd9ccab..c3cdfcbd 100644 --- a/42sh/src/lexer/lexer_dquote.c +++ b/42sh/src/lexer/lexer_dquote.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 18:36:58 by jhalford #+# #+# */ -/* Updated: 2017/02/10 00:33:34 by jhalford ### ########.fr */ +/* Updated: 2017/02/17 15:36:36 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_quote.c b/42sh/src/lexer/lexer_quote.c index 2d3a6432..9b1afbd1 100644 --- a/42sh/src/lexer/lexer_quote.c +++ b/42sh/src/lexer/lexer_quote.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:07:08 by jhalford #+# #+# */ -/* Updated: 2017/02/09 22:13:27 by jhalford ### ########.fr */ +/* Updated: 2017/02/17 15:28:13 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/stack_to_prompt.c b/42sh/src/lexer/stack_to_prompt.c index b79c208b..3a5cc8ff 100644 --- a/42sh/src/lexer/stack_to_prompt.c +++ b/42sh/src/lexer/stack_to_prompt.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 21:25:26 by jhalford #+# #+# */ -/* Updated: 2017/02/09 22:49:51 by jhalford ### ########.fr */ +/* Updated: 2017/02/17 14:41:08 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/data_init.c b/42sh/src/main/data_init.c index de9e0895..b4aae183 100644 --- a/42sh/src/main/data_init.c +++ b/42sh/src/main/data_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */ -/* Updated: 2017/02/09 16:31:07 by wescande ### ########.fr */ +/* Updated: 2017/02/17 14:37:52 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 6aad9f87..f988722f 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ -/* Updated: 2017/02/14 15:37:13 by gwojda ### ########.fr */ +/* Updated: 2017/02/17 15:26:59 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */