aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThijs <thijs@thijsschreijer.nl>2024-05-20 12:39:33 +0200
committerThijs <thijs@thijsschreijer.nl>2024-05-20 14:27:40 +0200
commit06c186da3c9108c9d0378e25a18bc6f605d43644 (patch)
tree90a3c1a3b71e5a1690eecfdf4435c102c87d769c /src
parentdcd5d62501e61e0f6901d4d4687ab56430a4b8a7 (diff)
downloadluasystem-06c186da3c9108c9d0378e25a18bc6f605d43644.tar.gz
luasystem-06c186da3c9108c9d0378e25a18bc6f605d43644.tar.bz2
luasystem-06c186da3c9108c9d0378e25a18bc6f605d43644.zip
implement getconsoleflags tests
Diffstat (limited to 'src')
-rw-r--r--src/term.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/term.c b/src/term.c
index e557a11..10b3e25 100644
--- a/src/term.c
+++ b/src/term.c
@@ -309,6 +309,7 @@ static HANDLE get_console_handle(lua_State *L, int flags_optional)
309// Lua error if the file is not one of these. 309// Lua error if the file is not one of these.
310static int get_console_handle(lua_State *L) 310static int get_console_handle(lua_State *L)
311{ 311{
312printf("get_console_handle\n");
312 FILE **file = (FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE); 313 FILE **file = (FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE);
313 if (file == NULL || *file == NULL) { 314 if (file == NULL || *file == NULL) {
314 return luaL_argerror(L, 1, "expected file handle"); // call doesn't return 315 return luaL_argerror(L, 1, "expected file handle"); // call doesn't return
@@ -375,9 +376,12 @@ static int lst_setconsoleflags(lua_State *L)
375 return 2; 376 return 2;
376 } 377 }
377 378
378#endif 379#else
379 lua_pushboolean(L, 1); 380 get_console_handle(L); // to validate args
381 lua_pushboolean(L, 1); // always return true on Posix
380 return 1; 382 return 1;
383
384#endif
381} 385}
382 386
383 387
@@ -417,6 +421,8 @@ static int lst_getconsoleflags(lua_State *L)
417 lua_pushliteral(L, "failed to get console mode"); 421 lua_pushliteral(L, "failed to get console mode");
418 return 2; 422 return 2;
419 } 423 }
424#else
425 get_console_handle(L); // to validate args
420 426
421#endif 427#endif
422 lsbf_pushbitflags(L, console_mode); 428 lsbf_pushbitflags(L, console_mode);