|
@@ -101,8 +101,7 @@ static bool_t clish_source(clish_context_t *context, const lub_argv_t * argv)
|
|
thread. Invoking a script in this way will cause the script to
|
|
thread. Invoking a script in this way will cause the script to
|
|
continue after command, but not script, errors.
|
|
continue after command, but not script, errors.
|
|
*/
|
|
*/
|
|
-static bool_t
|
|
+static bool_t clish_source_nostop(clish_context_t *context, const lub_argv_t * argv)
|
|
-clish_source_nostop(clish_context_t *context, const lub_argv_t * argv)
|
|
|
|
{
|
|
{
|
|
return (clish_source_internal(context, argv, BOOL_FALSE));
|
|
return (clish_source_internal(context, argv, BOOL_FALSE));
|
|
}
|
|
}
|
|
@@ -188,33 +187,21 @@ bool_t clish_shell_execute(clish_context_t *context, char **out)
|
|
int lock_fd = -1;
|
|
int lock_fd = -1;
|
|
sigset_t old_sigs;
|
|
sigset_t old_sigs;
|
|
struct sigaction old_sigint, old_sigquit;
|
|
struct sigaction old_sigint, old_sigquit;
|
|
|
|
+ clish_view_t *cur_view = clish_shell__get_view(this);
|
|
|
|
|
|
assert(cmd);
|
|
assert(cmd);
|
|
action = clish_command__get_action(cmd);
|
|
action = clish_command__get_action(cmd);
|
|
|
|
|
|
|
|
|
|
{
|
|
{
|
|
- clish_view_t *view = NULL;
|
|
|
|
- char *viewid = NULL;
|
|
|
|
clish_view_restore_t restore = clish_command__get_restore(cmd);
|
|
clish_view_restore_t restore = clish_command__get_restore(cmd);
|
|
-
|
|
|
|
if ((CLISH_RESTORE_VIEW == restore) &&
|
|
if ((CLISH_RESTORE_VIEW == restore) &&
|
|
- (clish_command__get_pview(cmd) != this->view))
|
|
+ (clish_command__get_pview(cmd) != cur_view)) {
|
|
- view = clish_command__get_pview(cmd);
|
|
+ clish_view_t *view = clish_command__get_pview(cmd);
|
|
- else if ((CLISH_RESTORE_DEPTH == restore) &&
|
|
+ clish_shell__set_pwd(this, NULL, view, NULL, context);
|
|
- (clish_command__get_depth(cmd) <
|
|
+ } else if ((CLISH_RESTORE_DEPTH == restore) &&
|
|
- clish_view__get_depth(this->view))) {
|
|
+ (clish_command__get_depth(cmd) < this->depth)) {
|
|
- view = clish_shell__get_pwd_view(this,
|
|
+ this->depth = clish_command__get_depth(cmd);
|
|
- clish_command__get_depth(cmd));
|
|
|
|
- viewid = clish_shell__get_pwd_viewid(this,
|
|
|
|
- clish_command__get_depth(cmd));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (view) {
|
|
|
|
- this->view = view;
|
|
|
|
-
|
|
|
|
- lub_string_free(this->viewid);
|
|
|
|
- this->viewid = lub_string_dup(viewid);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -295,22 +282,12 @@ bool_t clish_shell_execute(clish_context_t *context, char **out)
|
|
|
|
|
|
if (result) {
|
|
if (result) {
|
|
clish_view_t *view = clish_command__get_view(cmd);
|
|
clish_view_t *view = clish_command__get_view(cmd);
|
|
- char *viewid = clish_shell_expand(
|
|
+
|
|
- clish_command__get_viewid(cmd), SHELL_VAR_ACTION, context);
|
|
|
|
if (view) {
|
|
if (view) {
|
|
-
|
|
|
|
char *line = clish_shell__get_line(context);
|
|
char *line = clish_shell__get_line(context);
|
|
- clish_shell__set_pwd(this,
|
|
+ clish_shell__set_pwd(this, line, view,
|
|
- clish_command__get_depth(cmd),
|
|
+ clish_command__get_viewid(cmd), context);
|
|
- line, this->view, this->viewid);
|
|
|
|
lub_string_free(line);
|
|
lub_string_free(line);
|
|
-
|
|
|
|
- this->view = view;
|
|
|
|
- }
|
|
|
|
- if (viewid || view) {
|
|
|
|
-
|
|
|
|
- lub_string_free(this->viewid);
|
|
|
|
- this->viewid = viewid;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -360,30 +337,18 @@ bool_t clish_shell_exec_action(clish_action_t *action,
|
|
static bool_t clish_nested_up(clish_context_t *context, const lub_argv_t * argv)
|
|
static bool_t clish_nested_up(clish_context_t *context, const lub_argv_t * argv)
|
|
{
|
|
{
|
|
clish_shell_t *this = context->shell;
|
|
clish_shell_t *this = context->shell;
|
|
- clish_view_t *view = NULL;
|
|
|
|
- char *viewid = NULL;
|
|
|
|
- int depth = 0;
|
|
|
|
|
|
|
|
if (!this)
|
|
if (!this)
|
|
return BOOL_FALSE;
|
|
return BOOL_FALSE;
|
|
|
|
|
|
argv = argv;
|
|
argv = argv;
|
|
- depth = clish_view__get_depth(this->view);
|
|
|
|
|
|
|
|
|
|
|
|
- if (0 == depth) {
|
|
+ if (0 == this->depth) {
|
|
this->state = SHELL_STATE_CLOSING;
|
|
this->state = SHELL_STATE_CLOSING;
|
|
return BOOL_TRUE;
|
|
return BOOL_TRUE;
|
|
}
|
|
}
|
|
-
|
|
+ this->depth--;
|
|
- depth--;
|
|
|
|
- view = clish_shell__get_pwd_view(this, depth);
|
|
|
|
- viewid = clish_shell__get_pwd_viewid(this, depth);
|
|
|
|
- if (!view)
|
|
|
|
- return BOOL_FALSE;
|
|
|
|
- this->view = view;
|
|
|
|
- lub_string_free(this->viewid);
|
|
|
|
- this->viewid = viewid ? lub_string_dup(viewid) : NULL;
|
|
|
|
|
|
|
|
return BOOL_TRUE;
|
|
return BOOL_TRUE;
|
|
}
|
|
}
|