Good day, I am writing about a recent experience just in case it helps someone else in the future. I wrote an EPUB to TXT converter and announced it on the DOS Ain't Dead forum. It is an AWK script and it is named epub2txt.awk. It "shells out" to other utilities to do much of the work, including another AWK script named xml2tsv.awk.
I found that when i used DJGPP gawk.exe to run epub2txt.awk, it almost always produced terrible FAT corruption. Running the DIR command in the work directory and would show a bunch of garbage file names and subdirectory names. During troubleshooting, i tried holding down the F5 key during boot to make FreeDOS skip fdconfig.sys and fdauto.bat. That seemed to help. Then i found that commenting out the BUFFERS= and JemmEx lines in fdconfig.sys seemed to reduce the chances of FAT corruption. It merely made the problem more intermittent. I could not find any stable, working configuation. I tried other versions of DJGPP gawk.exe. Every version i could find produced the same FAT corruption. I switched to nawk32.exe and that eliminated the FAT corruption. At some point, i noticed data corruption within one of the output files. Fortunately it was reproducible. I found that it was related to the parent process (epub2txt.awk) having a file open when it ran a child process (xml2tsv.awk). I modified epub2txt.awk to make sure all files were closed prior to running the child process. This change prevented the data corruption with nawk32.exe. This change also fixed the issue with DJGPP gawk.exe. If i am careful to close all files prior to running a child process with gawk.exe, then it runs correctly without corrupting the drive. FAIL: print "hello" >"file1.txt" FAIL: system("gawk.exe -f child.awk <file2.xml >file3.tsv") FAIL: while ((getline <"file3.tsv") > 0) { ... } FAIL: close("file3.tsv") FAIL: print "world" >>"file1.txt" FAIL: close("file1.txt") PASS: print "hello" >"file1.txt" PASS: # The next line is the fix, closing files prior to child process. PASS: close("file1.txt") PASS: system("gawk.exe -f child.awk <file2.xml >file3.tsv") PASS: while ((getline <"file3.tsv") > 0) { ... } PASS: close("file3.tsv") PASS: print "world" >>"file1.txt" PASS: close("file1.txt") That's it for now. -Ben _______________________________________________ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user