mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-10 11:23:15 +00:00
Estimated hours taken: 2
Branches: main
Fix a bug in c2init where, if an error occurred, it would leave the
invalid output file around, causing problems the next time you ran Mmake.
This change also eliminates a dependency on using shell redirection (">")
when invoking system commands.
util/mkinit.c:
Add new option `-o' for specifying the output file name.
Also, if this option is specified, and there are any errors,
then remove the output file. This fixes the bug mentioned above.
Also, consistently use exit(EXIT_FAILURE) rather than exit(1).
scripts/c2init.in:
Add new option `-o'/`--output', which just passes `-o' to mkinit.
compiler/modules.m:
compiler/mercury_compile.m:
Use `-o' rather than shell redirection when invoking c2init.