doing some bquote expansion fix

This commit is contained in:
Jack Halford 2017-02-17 15:49:03 +01:00
parent 413121fcf8
commit b8bf58fbab
12 changed files with 43 additions and 11 deletions

View file

@ -84,6 +84,7 @@ exec/redirect_less.c\
exec/redirect_lessand.c\ exec/redirect_lessand.c\
exec/set_exitstatus.c\ exec/set_exitstatus.c\
glob/dir_glob.c\ glob/dir_glob.c\
glob/esc_print.c\
glob/expand_brace.c\ glob/expand_brace.c\
glob/expand_esc.c\ glob/expand_esc.c\
glob/expand_var.c\ glob/expand_var.c\

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/04 16:31:18 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, char **glob(char *str, unsigned char *esc,
unsigned char *dbl_esc); unsigned char *dbl_esc);
void esc_print(char *str, unsigned char *esc);
/* /*
** return TRUE if path file is a directory. ** return TRUE if path file is a directory.

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 21:13:23 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

30
42sh/src/glob/esc_print.c Normal file
View file

@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* esc_print.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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");
}

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/27 18:19:55 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/11 16:46:27 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 22:03:48 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 = (*alst)->content;
token->type = TK_WORD; token->type = TK_WORD;
if (lexer->state == DQUOTE_BQUOTE) if (lexer->state == DQUOTE_BQUOTE)
token_append(token, lexer, 1, 1); token_append(token, lexer, 1, 0);
else else
token_append(token, lexer, 0, 0); token_append(token, lexer, 0, 0);
if (lexer->str[lexer->pos] == '`') if (lexer->str[lexer->pos] == '`')

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 18:36:58 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 12:07:08 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 21:25:26 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 19:26:32 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/06 18:40:58 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */