mawk 1.3.4 20240622 for DOS (Announce)
> > The msvcrt.dll supplied with Windows XP seems to work - and I guess the
> > ones supplied with Win9x are also ok.
>
> Thanks! I tried the following MSVCRT.DLL and at first glance it appeared
> to work:
I didn't try them all, but I literally meant it when I said use old ReactOS's 0.3.14 version from 2012. I'm not sure others work as well.
I really should try some simple MAWK/Win32 tests under HX myself and report back. (Well, I don't use system() or popen() a lot there.)
BTW, you mentioned elsewhere some flaws (?) in DJGPP's build when you didn't explicitly close some files (i.e. FAT corruption). I believe the built-in GAWK lint (and/or debugger??) will hint at such things in advance.
N.B. I really don't see the point of using or preferring proprietary .DLLs from Win9x at all. In that case, just use DJGPP. However, most people already have several Windows licenses.
> C:\BEN\mawk\bin>mawk "BEGIN{print \"hi\"}"
> hi
>
> But on closer inspection, it appears to have trouble running itself.
>
> C:\BEN\mawk\bin>type test.awk
> function sys(str) {
> printf "test.awk: %s\n", str
> retval = system(str)
> print ""
> return retval
> }
>
> BEGIN {
> sys("cd")
>
> cmd = ARGV[0] " \"BEGIN{print \\\"hi\\\"}\""
> sys(cmd)
> exit 0
> }
> C:\BEN\mawk\bin>mawk -f test.awk
> test.awk: cd
> C:\BEN\MAWK\BIN
>
> test.awk: C:\ben\mawk\bin\mawk.exe "BEGIN{print \"hi\"}"
> C:\FreeDOS\BIN\COMMAND.COM: line 1: runaway regular expression /c
> ...
>
> I'm not sure what to blame: this win32 build of mawk.exe, HX, or something
> else.
It could be a RE library quirk. Realistically, I'd suspect HX, but it could be a Windows (which? XP? 10?) problem. Last I checked, MinGW stated an (untested??) minimum of Windows 10.
Specifically, DOS with all its different memory types and managers and environments makes things a bit confusing. There is less confusion on a modern OS where everything is all unified (a single memory API and default shell). You know, system() isn't really "portable". Alexei's SmallerC had some limitations and quirks trying to use system() in his compiler. By this I mean system() is maybe too simplistic and incomplete. Adding anything else (spawn? exec? fork?) makes a big mess for true portability.
If anything, I'd suggest to stick to simple file input and output with AWK, then use external tools with the shell to manipulate that data. Don't try to do it all mixed together.
Actually, REXX was specifically designed to do exactly what you want, pass data to and from environments without (much, if at all) use of the system shell. However, again, you have to be careful in DOS (enough free conventional memory? CWSDPMI support? needs different "extender" or DPMI host?). CWSDPMI (pure 32-bit DPMI) won't run DOS4GW binaries, for instance, and can clash with some OpenWatcom "extenders".
Seriously, I've played a lot with REXX lately, even in DOS, and it's easily as good as AWK. Howard Fosdick gives away his 2005 REXX book for free, too. I can point you to several builds of Regina (DJGPP, DOS4GW) and BRexx (BorlandC 386+ real mode, TurboC 8086, DJGPP / DPMI). Regina prefers ANSI REXX "ADDRESS SYSTEM 'dir' WITH INPUT STREAM 'in.txt' OUTPUT STEM dat." while BRexx (32-bit only, 16-bit's stack depth is too small) prefers "dir (stack" and "stack> sort". (Anything that isn't an internal REXX function or instruction is treated as an external command and shelled out.)
I just think some things on non-POSIX systems (like Windows) are never emulated properly, e.g. popen (hence the Win95 patches of that for AWK). In other words, dark corners exist, especially for Windows (non-*nix) builds. If some features don't work portably, don't rely on them.
Complete thread:
- mawk 1.3.4 20240622 for DOS - bencollver, 15.08.2024, 03:27 (Announce)
- mawk 1.3.4 20240622 for DOS - Rugxulo, 15.08.2024, 06:57
- mawk 1.3.4 20240622 for DOS - bencollver, 15.08.2024, 16:27
- mawk 1.3.4 20240622 for DOS - Rugxulo, 15.08.2024, 16:40
- mawk 1.3.4 20240622 for DOS - bencollver, 15.08.2024, 17:33
- mawk 1.3.4 20240622 for DOS - Rugxulo, 16.08.2024, 04:21
- mawk 1.3.4 20240622 for DOS - bencollver, 16.08.2024, 04:45
- mawk 1.3.4 20240622 for DOS - Oso2k, 16.08.2024, 15:27
- mawk 1.3.4 20240622 for DOS - Rugxulo, 25.08.2024, 01:09
- mawk 1.3.4 20240622 for DOS - Japheth, 25.08.2024, 07:04
- mawk 1.3.4 20240622 for DOS - Rugxulo, 16.08.2024, 04:21
- mawk 1.3.4 20240622 for DOS - bencollver, 15.08.2024, 17:33
- mawk 1.3.4 20240622 for DOS - Rugxulo, 15.08.2024, 16:40
- mawk 1.3.4 20240622 for DOS - bencollver, 20.08.2024, 03:35
- mawk 1.3.4 20240622 for DOS - Japheth, 20.08.2024, 13:27
- mawk 1.3.4 20240622 for DOS - bencollver, 21.08.2024, 00:38
- mawk 1.3.4 20240622 for DOS - Rugxulo, 21.08.2024, 12:50
- mawk 1.3.4 20240622 for DOS - Japheth, 21.08.2024, 17:02
- mawk 1.3.4 20240622 for DOS - bencollver, 21.08.2024, 18:55
- mawk 1.3.4 20240622 for DOS - Rugxulo, 21.08.2024, 23:25
- mawk 1.3.4 20240622 for DOS - bencollver, 22.08.2024, 02:09
- mawk 1.3.4 20240622 for DOS - Japheth, 23.08.2024, 00:55
- mawk 1.3.4 20240622 for DOS - bencollver, 23.08.2024, 03:08
- mawk 1.3.4 20240622 for DOS - Japheth, 23.08.2024, 08:14
- mawk 1.3.4 20240622 for DOS - bencollver, 23.08.2024, 17:34
- mawk 1.3.4 20240622 for DOS - Japheth, 23.08.2024, 19:22
- mawk 1.3.4 20240622 for DOS - bencollver, 23.08.2024, 19:53
- mawk 1.3.4 20240622 for DOS - Japheth, 03.09.2024, 21:26
- mawk 1.3.4 20240622 for DOS - bencollver, 23.08.2024, 19:53
- mawk 1.3.4 20240622 for DOS - Japheth, 23.08.2024, 19:22
- mawk 1.3.4 20240622 for DOS - bencollver, 23.08.2024, 17:34
- mawk 1.3.4 20240622 for DOS - Japheth, 23.08.2024, 08:14
- mawk 1.3.4 20240622 for DOS - bencollver, 23.08.2024, 03:08
- mawk 1.3.4 20240622 for DOS - Japheth, 23.08.2024, 00:55
- mawk 1.3.4 20240622 for DOS - bencollver, 22.08.2024, 02:09
- mawk 1.3.4 20240622 for DOS - Rugxulo, 21.08.2024, 23:25
- mawk 1.3.4 20240622 for DOS - bencollver, 21.08.2024, 18:55
- mawk 1.3.4 20240622 for DOS - bencollver, 21.08.2024, 00:38
- mawk 1.3.4 20240622 for DOS - Japheth, 20.08.2024, 13:27
- mawk 1.3.4 20240622 for DOS - bencollver, 15.08.2024, 16:27
- mawk 1.3.4 20240622 for DOS - bencollver, 24.08.2024, 04:55
- mawk 1.3.4 20240622 for DOS - Rugxulo, 24.08.2024, 13:34
- mawk 1.3.4 20240622 for DOS - bencollver, 24.08.2024, 18:05
- mawk 1.3.4 20240622 for DOS - Rugxulo, 24.08.2024, 13:34
- mawk 1.3.4 20240622 for DOS - Rugxulo, 15.08.2024, 06:57