summaryrefslogtreecommitdiffstats
path: root/src/c_utils.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-09-11 16:01:55 +0200
committersalad <fmoenne-@student.le-101.fr>2020-09-11 16:01:55 +0200
commit5c8ded7ac978cde22cba31d1d03086f9a60a101b (patch)
tree0f75f3f47c2c43fed7b1fd24b1d78a435310ec85 /src/c_utils.c
parenthome works, not END. lets go for a bit of norming (diff)
download42-minishell-5c8ded7ac978cde22cba31d1d03086f9a60a101b.tar.gz
42-minishell-5c8ded7ac978cde22cba31d1d03086f9a60a101b.tar.bz2
42-minishell-5c8ded7ac978cde22cba31d1d03086f9a60a101b.tar.xz
42-minishell-5c8ded7ac978cde22cba31d1d03086f9a60a101b.tar.zst
42-minishell-5c8ded7ac978cde22cba31d1d03086f9a60a101b.zip
grep TODO c_utils.c
Diffstat (limited to 'src/c_utils.c')
-rw-r--r--src/c_utils.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/c_utils.c b/src/c_utils.c
index 2b2f8e4..d5a45e0 100644
--- a/src/c_utils.c
+++ b/src/c_utils.c
@@ -24,10 +24,12 @@
/*
** TODO:
-** term(0) on exit
-** cursor on char insert DONE
** quotes
** leaks
+** C-c
+** tests varies
+** term(0) on exit DONE
+** cursor on char insert DONE
*/
int16_t
@@ -47,13 +49,17 @@ int16_t
tcaps->CL[1] = 0;
tcaps->CL[2] = 0;
tcaps->CL[3] = 0;
+ tcaps->CC[0] = 3;
+ tcaps->CC[1] = 0;
+ tcaps->CC[2] = 0;
+ tcaps->CC[3] = 0;
tcaps->HM[0] = 27;
tcaps->HM[1] = 91;
tcaps->HM[2] = 72;
tcaps->HM[3] = 0;
tcaps->ND[0] = 27;
tcaps->ND[1] = 91;
- tcaps->ND[2] = 70;
+ tcaps->ND[2] = -103;
tcaps->ND[3] = 0;
return (1);
}
@@ -74,6 +80,27 @@ uint16_t
return (1);
}
+int16_t
+ c_new_line(char *buf,
+ char **line,
+ t_msh *msh,
+ t_caps *tcaps)
+{
+ write(1, buf, ft_strlen(buf));
+ tputs(tgetstr("cr", NULL), 1, ft_putchar);
+ c_set_term_raw(0);
+ if (line != NULL)
+ {
+ m_parse_and_run_line(*line, msh);
+ *line = NULL;
+ }
+ tcaps->cpos = 0;
+ tputs(tgetstr("cr", NULL), 1, ft_putchar);
+ c_set_term_raw(1);
+ m_prompt_psx(1, msh);
+ return (1);
+}
+
char
*c_insert_char(char *str,
char c,