Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

mawk 1.3.4 20240622 for DOS (Announce)

posted by bencollver Homepage, 21.08.2024, 18:55

> Here's the output that I got in MS-DOS 7.1 when I run your test program (
> with msvcrt.dll from XP SP3 ):
>
>
> test.awk: cd
> C:\TEMP\bin
>
> test.awk: c:\temp\bin\mawk.exe "BEGIN{print \"hi\"}"
> hi
>

>
> haven't tried the dll of your link yet...
>
> EDIT: tried "your" dll, same result as above.

Curiouser and curiouser...

I reproduced the problem on MS-DOS 6.22. That eliminates FreeDOS.

I reproduced the problem in a Watcom win32 build of mawk. That eliminates mingw and MSVCRT.DLL.

I reproduced the problem using short sample C code built with Watcom. That eliminates mawk.

Note how the win32 version of test2.exe inserts extraneous arguments when it uses the system() C library call, but the DOS version doesn't.

https://bencollver.bitbucket.io/files/hxtest.zip

C:\hxtest\dos>test.exe foo bar
COMSPEC=C:\FreeDOS\BIN\COMMAND.COM
argc=3
argv[0]=C:\HXTEST\DOS\TEST.EXE
argv[1]=foo
argv[2]=bar


C:\hxtest\dos>test2.exe test.exe foo bar
COMSPEC=C:\FreeDOS\BIN\COMMAND.COM
argc=3
argv[0]=C:\HXTEST\DOS\TEST.EXE
argv[1]=foo
argv[2]=bar


C:\hxtest\win32>test.exe foo bar
DPMILD32: Module=hxguihlp.dll
DPMILD32: File not found error
COMSPEC=C:\FreeDOS\BIN\COMMAND.COM
argc=3
argv[0]=c:\hxtest\win32\test.exe
argv[1]=foo
argv[2]=bar


C:\hxtest\win32>test2.exe test.exe foo bar
DPMILD32: Module=hxguihlp.dll
DPMILD32: File not found error
DPMILD32: Module=hxguihlp.dll
DPMILD32: File not found error
COMSPEC=C:\FreeDOS\BIN\COMMAND.COM
argc=5
argv[0]=c:\hxtest\win32\test.exe
argv[1]=/c
argv[2]=test.exe
argv[3]=foo
argv[4]=bar


C:\hxtest>type test.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    int i;
    char *str;
    str = getenv("COMSPEC");
    printf("COMSPEC=%s\n", str);
    printf("argc=%d\n", argc);
    for (i = 0; i < argc; i++) {
        printf("argv[%d]=%s\n", i, argv[i]);
    }
    exit(0);
}


C:\hxtest>type test2.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[]) {
    int i, result;
    char buf[256];
    if (argc < 1) {
        printf("Usage: test2.exe args...\n");
        exit(1);
    }
    strcpy(buf, argv[1]);
    for (i = 2; i < argc; i++) {
        strcat(buf, " ");
        strcat(buf, argv[i]);
    }
    result = system(buf);
    exit(result);
}

 

Complete thread:

Back to the forum
Board view  Mix view
22033 Postings in 2032 Threads, 396 registered users, 79 users online (0 registered, 79 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum