Hi, > On Jun 5, 2024, at 7:46 AM, Bernd Böckmann via Freedos-devel > <freedos-devel@lists.sourceforge.net> wrote: > > >> Am 04.06.2024 um 09:31 schrieb Wolf Bergenheim via Freedos-devel >> <freedos-devel@lists.sourceforge.net>: >> >> I did some more digging... Found a wikipedia article discussing it [1] but >> maybe more interesting was a german text on 4dos tips[2] apparently Windows >> 95 only put the rest of the command line in CMDLINE. > > The 4dos tips article states that only the command.com of the Windows 95 > preview restricted CMDLINE env to the missing part, and the release version > includes the full command line. > >> Rugxulo, do you know if IA-16 GCC also supports it? If not it should >> probably also be patched... > > I think the relevant part to look at is newlib, the C library implementation > used by IA16-GCC. I had a quick look at it, but only found the usual PSP > command tail thing. Maybe I miss something: > > https://github.com/tkchia/newlib-ia16/blob/bad4dfe895de09aae26271de18acfa99ca286a71/libgloss/ia16/dos-models-crt0.S#L250 > > Bernd
From a library or a programs standpoint, it is not difficult to implement. I’ve already done that in the new NASM library I have been working on. I fact that macro is not even susceptible to those 3 recent bugs we discovered in FreeCOM regarding the passing of long command line parameters. And should have no compatibility issues when the fix for those bugs is released. https://gitlab.com/DOSx86/mini-editor/-/blob/7705d83ad1626fe4055cace13e56e02bf0713fe8/SOURCE/MINIEDIT/lazyboy/lazysys.inc#L328 <https://gitlab.com/DOSx86/mini-editor/-/blob/7705d83ad1626fe4055cace13e56e02bf0713fe8/SOURCE/MINIEDIT/lazyboy/lazysys.inc#L328> Basically, the assembly code works like this… When the environment table contains an entry for CMDLINE, Set String pointer to its value and goto step 6 Set string pointer to PSP Command Tail string. Determine if string contains Terminating CR character If so, replace with NULL. If it is missing append a NULL. We now have an ASCIIZ. goto step 10 Increment string pointer one character. Compare the string to 125 characters in the PSP Command Tail (DR-DOS is limited to 125 because it always appends CR+NULL) If it matches, we are at the start of the parameter data, goto step 10 Otherwise, repeat, goto step 6 We now either have a pointer to PSP command tail or Environment Table command tail via CMDLINE Here I trim off any leading spaces by incrementing the string pointer. Finally, I test if the remaining ASCIIZ string is NULL. If so, set Carry Flag on return. Other than the retrieval of the CMDLINE environment variable (which is a separate macro), the assembly for this is not much longer than the above description. Probably about the same if you bother counting characters. Actually, I see two lines in the code from early in the development of this macro that should be removed. They don’t hurt anything. But, they will never do anything either. The end result is that the program gets one or the other as an ASCIIZ and without the (possibly erroneous) executable name that would be included in the CMDLINE variable. Going from 126 to 127 characters, the returned pointer to an ASCIIZ string does the same. It is simply 1 character longer. Works great. It even supports unusually command line things when the first string characters is not a space like prog/x or prog;y. There is only one potential issue. The odds are astronomical and maybe not even be a possibility. I guess I could a bunch of test against Win95/98. But, I’ll just wait until the root of the issue in FreeCOM is fixed. Basically, that issue involves Long File named paths and executables. See https://github.com/FDOS/freecom/issues/97#issuecomment-2131437919 <https://github.com/FDOS/freecom/issues/97#issuecomment-2131437919>. For now, the comparison of the strings will work well enough. :-) Jerome
_______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel