Glue between the null display driver and the rest of Magic so that
running with -d null does not require any process-level resources
(signals, timers, stdin, an X display, or a Tcl interpreter).
* utils/signals.c — gate setitimer, fcntl-based file watches, kill
and the legacy sigsetmask/sigaction setup behind #ifdef
__EMSCRIPTEN__. Every signals path becomes a no-op in WASM.
Also fixes DBWriteBackup() being called with one argument when
its real prototype takes three.
* windows/windDisp.c — WindUpdate() returns immediately when
GrDisplayStatus == DISPLAY_SUSPEND. This is the runtime
counterpart to the null driver's DISPLAY_SUSPEND state.
* extflat/EFargs.c — EFArgs() with a missing input name no longer
jumps to "usage:" in headless WASM (which would call MainExit and
kill the process); it sets *err_result and returns NULL so the
caller can decide what to do. Native MAGIC_WRAPPER and native
non-MAGIC_WRAPPER builds keep their original behavior.
* dbwind/DBWcommands.c — registers exttosim / ext2sim / exttospice /
ext2spice in non-MAGIC_WRAPPER builds. Without this, WASM users
could not invoke these commands at all (they were previously
inside an #ifdef MAGIC_WRAPPER block). The C implementations
(CmdExtToSim / CmdExtToSpice) are linked unconditionally outside
modular builds.
* textio/txCommands.c, textio/textio.h — TxDispatchString(), a new
library-style command entry point that parses a single string,
dispatches it through WindSendCommand and returns a status code.
This is what magic_wasm_run_command() calls from JavaScript.
and forcing it to be passed as an argument to all the callback
functions for the search routines that require it. Magic now
compiles and runs with the new code, but there are a number of
known issues that need to be fixed up. Committing now so that
I can rebase on the last update to the master branch.
Fix code scanning alert no. 133: Redundant null check due to previous dereference (#40)
* Update windDisp.c
* DLM - AI wanted to guard the '*area' dereference in if() statement, but the code path above has address of '&' operator for the assignment to 'area' so it must always be non-null. So I rejected this approach and removed the extra null check, replacing it with an assert().
---------
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>