Fix building QVMs on Linux with Windows line endings

On non-Windows, compiling QVM tools failed if dagcheck.md had CRLF line
endings and compiling QVMs failed if game source had CRLF line endings.

Also made Windows open the files as binary (no automatic CRLF to LF) so
it behaves the same as on non-Windows.
This commit is contained in:
Zack Middleton committed 2023-12-26 23:26:47 -05:00
1 parent b07ff2a3ca
commit 5ede35d8dd
5 files changed
+72 -2

No files matched your search

+6
View File
@@ -65,6 +65,9 @@ setup(int argc, char **argv)
fp = (char*)newstring((uchar*)argv[optind], strlen(argv[optind]), 0);
if ((fd = open(fp, 0)) <= 0)
error(FATAL, "Can't open input file %s", fp);
#ifdef WIN32
_setmode(fd, _O_BINARY);
#endif
}
if (optind+1<argc) {
int fdo;
@@ -75,6 +78,9 @@ setup(int argc, char **argv)
#endif
if (fdo<0)
error(FATAL, "Can't open output file %s", argv[optind+1]);
#ifdef WIN32
_setmode(fdo, _O_BINARY);
#endif
dup2(fdo, 1);
}
if(Mflag)