|
@@ -97,23 +97,15 @@ void clish_shell_load_scheme(clish_shell_t * this, const char *xml_path)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-enum {
|
|
|
- RETVAL_OK = 0, /* OK */
|
|
|
- RETVAL_UNKNOWN = 1, /* Unknown error */
|
|
|
- RETVAL_NOSTDIN = 2, /* No stdin found */
|
|
|
- RETVAL_SCRIPT = 3, /* Script execution error */
|
|
|
- RETVAL_SYNTAX = 4 /* Syntax error */
|
|
|
-};
|
|
|
-
|
|
|
/*-------------------------------------------------------- */
|
|
|
static int _loop(clish_shell_t * this, bool_t is_thread)
|
|
|
{
|
|
|
int running = 0;
|
|
|
- int retval = RETVAL_OK;
|
|
|
+ int retval = SHELL_STATE_OK;
|
|
|
|
|
|
assert(this);
|
|
|
if (!tinyrl__get_istream(this->tinyrl))
|
|
|
- return RETVAL_NOSTDIN;
|
|
|
+ return SHELL_STATE_IO_ERROR;
|
|
|
/* Check the shell isn't closing down */
|
|
|
if (this && (SHELL_STATE_CLOSING == this->state))
|
|
|
return retval;
|
|
@@ -122,7 +114,7 @@ static int _loop(clish_shell_t * this, bool_t is_thread)
|
|
|
pthread_testcancel();
|
|
|
/* Loop reading and executing lines until the user quits */
|
|
|
while (!running) {
|
|
|
- retval = RETVAL_OK;
|
|
|
+ retval = SHELL_STATE_OK;
|
|
|
/* Get input from the stream */
|
|
|
running = clish_shell_readline(this, NULL);
|
|
|
if (running) {
|
|
@@ -133,13 +125,8 @@ static int _loop(clish_shell_t * this, bool_t is_thread)
|
|
|
if (tinyrl__get_isatty(this->tinyrl) ||
|
|
|
!this->current_file->stop_on_error)
|
|
|
running = 0;
|
|
|
- if (SHELL_STATE_SCRIPT_ERROR == this->state)
|
|
|
- retval = RETVAL_SCRIPT;
|
|
|
- else
|
|
|
- retval = RETVAL_SYNTAX;
|
|
|
- break;
|
|
|
+ retval = this->state;
|
|
|
default:
|
|
|
- retval = RETVAL_UNKNOWN;
|
|
|
break;
|
|
|
}
|
|
|
}
|