tkchia / newlib-ia16

Fork of IA-16 port of Newlib -- added small and medium model support
GNU General Public License v2.0
13 stars 4 forks source link

Does gcc-ia16 / newlib support argv processing of command lines over 127 chars? #24

Open andrewbird opened 3 months ago

andrewbird commented 3 months ago

Hello @tkchia, I'm writing a test for Dosemu2 / FDPP to check the processing of a program's command line. From what I read here https://en.wikipedia.org/wiki/Program_Segment_Prefix and I see when testing against MS-DOS 7.00, when the length of the command line exceeds 0x7f, the program should consult the CMDLINE environment variable in preference to the PSP stored command line. I have this working with a gcc-ia16 test program [0] that accesses the PSP directly, but as a check I thought I would see what ended up in argv[1], however it seems to be only the value gleaned from the PSP as it's truncated.

rem The command line (150 chars long after command name)
C:\>cmdlen TEST08____12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

rem summary of data from CMDLINE env variable (length byte) [len-2:len-1:len]
TEST08 (150)[39:30:00]

rem printf of argv[1]
TEST08____1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345

I'm presuming that the argv processing used by gcc-ia16 is done by newlib, and that currently it has no provision for longer lines stored in CMDLINE env var. Would that be something that could be added to it?

Thank you!

[0] - https://github.com/andrewbird/dosemu2/commit/8ba4f7d5a0be3132eedad7275766224441c3ee53