diff --git a/42sh/README.md b/42sh/README.md
index da7ed695..ef9553cd 100644
--- a/42sh/README.md
+++ b/42sh/README.md
@@ -23,12 +23,12 @@ Optional feature (five of theses are mandatory to validate the project):
- Dynamical autocompletion.
Optional feature highly appreciated:
-- Job Control and builtins `job`, `fg`, `bg`and operand `&`.
+- Job Control and builtins `job`, `fg`, `bg` and operand `&`.
- Shell Scripting.
-## shell / subshell
+## Shell / Subshell
-## line editing
+## Line editing
Keys|Functions|
:-:|:--
@@ -39,7 +39,7 @@ Keys|Functions|
Ctrl+C|Terminate/Kill current foreground process.
Ctrl+Z|Suspend/Stop current foreground process.
-## history
+## History
Keys|Functions|
:-:|:--
@@ -51,8 +51,43 @@ Keys|Functions|
`!name`|Search for a command beginning with `name`.
`!?name`|Search for a command which contain `name`.
-## autocompletion
-## globbing
-## hash table
-## job control
+## Autocompletion
+
+Autocompletion works with binary, path and env variable.
+Output is colored upon type.
+Using arrows to navigate is supported.
+Autorefreshing with a new input from the user: modification of the list of possibility.
+
+Commands|Functions|
+:-:|:--
+`$> l[tab]`|Search for binary.
+`$> ls s[tab]`|Search for path/files.
+`$> $[tab]`|Search for variables in `env`.
+
+## Globbing
+
+Pattern|Behavior|
+:-:|:--
+`*`|Everything.
+`**`|Match directory and sub-directory.
+`?`|Single char.
+`[a-z]`|Match range from `a` to `z`.
+`[!a-z]` `[^a-z]`|Exclude range from `a` to `z`.
+`{ab, ac}`|Match `ab` or `ac`.
+
+## Hash table
+
+Commands|Functions|
+:-:|:--
+`hash`|List the content of the hash table.
+`hash -r`|Clear the memory of the hash table.
+
+## Job Control
+
+Commands|Functions|
+:-:|:--
+`jobs`|List all the current running jobs.
+`fg`|Bring the most recent process to foreground.
+`fg n`|Bring the specified jobs to foreground where `n` is the numerical value of the process found in `jobs`.
+
## scripting
diff --git a/42sh/src/exec/exec_reset.c b/42sh/src/exec/exec_reset.c
index c4ba1f07..e1865178 100644
--- a/42sh/src/exec/exec_reset.c
+++ b/42sh/src/exec/exec_reset.c
@@ -6,7 +6,7 @@
/* By: jhalford +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */
-/* Updated: 2017/03/22 18:26:03 by jhalford ### ########.fr */
+/* Updated: 2017/03/24 14:06:48 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,7 +16,7 @@ int exec_reset_job(t_job *job)
{
job->id = 0;
job->pgid = 0;
- job->attrs = JOB_NOTIFIED;
+ job->attrs = 0;
job->first_process = NULL;
return (0);
}
diff --git a/42sh/src/job_control/builtin_jobs.c b/42sh/src/job_control/builtin_jobs.c
index 7a4c35b3..15f0e33a 100644
--- a/42sh/src/job_control/builtin_jobs.c
+++ b/42sh/src/job_control/builtin_jobs.c
@@ -6,7 +6,7 @@
/* By: jhalford +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/15 17:43:01 by jhalford #+# #+# */
-/* Updated: 2017/03/24 12:35:04 by wescande ### ########.fr */
+/* Updated: 2017/03/24 14:08:12 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@@ -66,13 +66,13 @@ int builtin_jobs(const char *path, char *const av[], char *const envp[])
(void)path;
(void)envp;
- ft_bzero(&data, sizeof(t_data_template));
do_job_notification();
if (!SH_HAS_JOBC(data_singleton()->opts))
{
SH_ERR("jobs: %s", SH_MSG_NOJOBC);
return (1);
}
+ ft_bzero(&data, sizeof(t_data_template));
if (cliopts_get((char**)av, g_jobs_opts, &data))
return (ft_perror());
if (!*data.av_data)
diff --git a/42sh/src/lexer/get_state_global.c b/42sh/src/lexer/get_state_global.c
index 0fa045fc..b3b1846c 100644
--- a/42sh/src/lexer/get_state_global.c
+++ b/42sh/src/lexer/get_state_global.c
@@ -6,7 +6,7 @@
/* By: jhalford +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */
-/* Updated: 2017/03/20 15:00:58 by jhalford ### ########.fr */
+/* Updated: 2017/03/24 14:20:30 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@@ -21,7 +21,8 @@ t_lexstate get_state_global(t_lexer *lexer)
c = lexer->str[lexer->pos];
cn = lexer->str[lexer->pos + 1];
- cl = lexer->str[lexer->pos ? lexer->pos - 1 : 0];
+ cl = lexer->pos ? lexer->str[lexer->pos - 1] : 0;
+ DG("%i : '%c'", lexer->pos, cl);
ret = 0;
if ((ft_is_delim(c) && (ret = DELIM))
|| ((c == '&' || c == ';' || c == '|' || c == '!') && (ret = SEP))
@@ -31,7 +32,8 @@ t_lexstate get_state_global(t_lexer *lexer)
|| ((c == '\"') && (ret = DQUOTE))
|| ((c == '`') && (ret = BQUOTE))
|| ((c == '(' || c == ')') && (ret = PAREN))
- || (((c == '{' && cn == ' ') || (c == '}' && cl == ' '))
+ || (((c == '{' && (cn == ' ' || cn == 0))
+ || (c == '}' && (cl == ' ' || cl == 0)))
&& (ret = CURLY_BRACKETS))
|| ((c == 0) && (ret = END)))
{
diff --git a/42sh/src/line_editing/control_features.c b/42sh/src/line_editing/control_features.c
index 8db2f684..4b0d0743 100644
--- a/42sh/src/line_editing/control_features.c
+++ b/42sh/src/line_editing/control_features.c
@@ -6,7 +6,7 @@
/* By: gwojda +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/02 15:17:28 by gwojda #+# #+# */
-/* Updated: 2017/03/18 15:13:46 by gwojda ### ########.fr */
+/* Updated: 2017/03/24 14:05:58 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@@ -26,6 +26,8 @@ int ft_buff_f6(char **str, size_t *pos)
int ft_control_d(char **str, size_t *pos)
{
+ if (!data_singleton()->line.is_prompt)
+ return (0);
if (!*str || (*str)[0] == '\0')
{
ft_putstr("exit\n");