Skip to contentSkip to conversation

ugetcwd / uchdir freakiness

DISCUSSION Stas Sergeev 2 participants 2 messages Apr 21, 2003

lore
Share & tools
lore
#0 lore raw

Hello.

Quoted 2 lines · Pawel Szymczykowski

Not sure where the problem is exactly, but I can't seem to get ugetcwd and uchdir to work.. in fact, they have some pretty weird results.

Well, you are not alone. Since the dosemu utilities were ported to so called "coopthreads", various people are reporting the weird problems (but for me and most others everything works OK).
I think sooner or later we'll have to return back to the known-good standalone-style tools:(
I was thinking about re-implementing the coopthreads idea based on a do_call_back() functionality, but at least for the comcom it won't work. I was asking the appropriate people several times about dropping the comcom (which itself makes more problems than the coopthreads do) but so far there were only a very inconclusive responses.

For now: type "make dosbin" which will create a standalone-style tools for you, which shouldn't have any problems.

#1 lore raw
Quoted 12 lines · Stas Sergeev
Quoted 2 lines · Pawel Szymczykowski

Not sure where the problem is exactly, but I can't seem to get ugetcwd and uchdir to work.. in fact, they have some pretty weird results.

Well, you are not alone. Since the dosemu utilities were ported to so called "coopthreads", various people are reporting the weird problems (but for me and most others everything works OK).
I think sooner or later we'll have to return back to the known-good standalone-style tools:(

the problem with those (well partly) is that we'd need to rely on third party compilers ("invoke tcc via dosemu").

With "make dosbin" you get some but not all. However, uchdir is only problematic when you invoke it inside "comcom" -- then it behaves like an internal command.

There was an oversight from Hans I think here: "uchdir" eats heap but isn't placed in that category.

Try this patch:

src/plugin/commands/comcom.c +1 -1
diff -urN dosemu-1.1.4.15/src/plugin/commands/comcom.c dosemu-1.1.4.16/src/plugin/commands/comcom.c
@@ -2881,11 +2881,11 @@
 	{"ecpuon",	ecpuon_main, 1},
 	{"eject",	eject_main, 1},
 	{"emumouse",	emumouse_main, 1},
-	{"ugetcwd",	ugetcwd_main, 1},
 	{"vgaoff",	vgaoff_main, 1},
 	{"vgaon",	vgaon_main, 1},
 
 #ifdef USE_HEAP_EATING_BUILTINS
+	{"ugetcwd",	ugetcwd_main, 1},
 	{"lredir",	lredir_main, 1},
 	{"unix",	unix_main, 1},
 	{"dosdbg",	dosdbg_main, 1},
src/plugin/commands/commands.c +1 -1
diff -urN dosemu-1.1.4.15/src/plugin/commands/commands.c dosemu-1.1.4.16/src/plugin/commands/commands.c
@@ -148,7 +148,7 @@
 	struct com_starter_seg  *ctcb = owntcb->params;
 	char *s = lowmem_alloc(256);
 
-	LWORD(ecx) = 1024;
+	LWORD(ecx) = 256;
 	LWORD(edx) = COM_OFFS_OF(s);
 	do_doshelper(DOS_HELPER_GETCWD, 0);
 	com_printf("%s\n", s);

Bart