From 74766656e5b605785e0e9622eb7f10d20a5467e3 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 8 Sep 2020 20:26:51 +0200 Subject: I hate myself and I want to die --- src/u_parse.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/u_parse.c (limited to 'src/u_parse.c') diff --git a/src/u_parse.c b/src/u_parse.c new file mode 100644 index 0000000..ade8dd7 --- /dev/null +++ b/src/u_parse.c @@ -0,0 +1,55 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* u_parse.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include "d_define.h" + +t_quote_mode + u_meet_dquote(char *head, char *ptr, t_quote_mode mode) +{ + if (mode == Q_NONE) + { + if (u_is_not_escaped(head, ptr) == TRUE) + { + return (Q_DOUBLE); + } + else + { + return (Q_NONE); + } + } + else if (mode == Q_DOUBLE && u_is_not_escaped(head, ptr) == TRUE) + { + return (Q_NONE); + } + return (mode); +} + +t_quote_mode + u_meet_squote(char *head, char *ptr, t_quote_mode mode) +{ + if (mode == Q_NONE) + { + if (u_is_not_escaped(head, ptr) == TRUE) + { + return (Q_SINGLE); + } + else + { + return (Q_NONE); + } + } + else if (mode == Q_SINGLE) + { + return (Q_NONE); + } + return (mode); +} -- cgit v1.2.3 From c68b7637d42fac3986857685980e7a7090f5a5aa Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 9 Sep 2020 16:17:52 +0200 Subject: In progress --- src/u_parse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/u_parse.c') diff --git a/src/u_parse.c b/src/u_parse.c index ade8dd7..b49e6ba 100644 --- a/src/u_parse.c +++ b/src/u_parse.c @@ -10,10 +10,13 @@ /* */ /* ************************************************************************** */ +#include + +#include "u_utils.h" #include "d_define.h" t_quote_mode - u_meet_dquote(char *head, char *ptr, t_quote_mode mode) + u_meet_dquote(const char *head, char *ptr, t_quote_mode mode) { if (mode == Q_NONE) { @@ -34,7 +37,7 @@ t_quote_mode } t_quote_mode - u_meet_squote(char *head, char *ptr, t_quote_mode mode) + u_meet_squote(const char *head, char *ptr, t_quote_mode mode) { if (mode == Q_NONE) { -- cgit v1.2.3