mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
Fix some issues and do some code cleanup
This commit is contained in:
parent
1f229e4efc
commit
312ed5c67c
72 changed files with 880 additions and 982 deletions
14
third_party/lua/lrepl.c
vendored
14
third_party/lua/lrepl.c
vendored
|
@ -234,9 +234,9 @@ static ssize_t pushline (lua_State *L, int firstline) {
|
|||
ssize_t rc;
|
||||
char *prmt;
|
||||
globalL = L;
|
||||
prmt = strdup(get_prompt(L, firstline));
|
||||
lua_pop(L, 1); /* remove prompt */
|
||||
if (lua_repl_isterminal) {
|
||||
prmt = strdup(get_prompt(L, firstline));
|
||||
lua_pop(L, 1); /* remove prompt */
|
||||
LUA_REPL_UNLOCK;
|
||||
rc = linenoiseEdit(lua_repl_linenoise, prmt, &b, !firstline || lua_repl_blocking);
|
||||
free(prmt);
|
||||
|
@ -250,9 +250,17 @@ static ssize_t pushline (lua_State *L, int firstline) {
|
|||
LUA_REPL_LOCK;
|
||||
} else {
|
||||
LUA_REPL_UNLOCK;
|
||||
fputs(prmt, stdout);
|
||||
fflush(stdout);
|
||||
b = linenoiseGetLine(stdin);
|
||||
if (b) {
|
||||
rc = 1;
|
||||
} else if (ferror(stdin)) {
|
||||
rc = -1;
|
||||
} else {
|
||||
rc = 0;
|
||||
}
|
||||
LUA_REPL_LOCK;
|
||||
rc = b ? 1 : -1;
|
||||
}
|
||||
if (!(rc == -1 && errno == EAGAIN)) {
|
||||
write(1, "\n", 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue