I know where and what is the problem:
The problem is here (see the comments):
In src/plugin/commands/builtins.c :
int commands_plugin_inte6(void)
{
....
/****
This doesn't work with DOS versions < 4.0x
In DOS 3.x the last byte in MCB is empty doesn't have
the MCB owner's name
****/
builtin_name = strlower(com_strdup(mcb->name));
builtin_name[8] = 0;
....
/****
This fails under DOS 3.x, builtin_name is empty or has garbage
****/
com = find_com_program(builtin_name);
if (com) {
com->program(argc, args);
} else {
/****
This is the error I got
****/
error("inte6: unknown builtin: %s\n",builtin_name);
}
return 1;
}
In src/include/dos2linux.h:
struct MCB {
char id; /* 0 */
unsigned short owner_psp; /* 1 */
unsigned short size; /* 3 */
char align8[3]; /* 5 */
char name[8]; /* 8 */
} __attribute__((packed));
The last 8 byte field only contains the name of the MCB owner in
DOS >= 4.0x or DR DOS >= 5.0
I even did an (unsuccessful) attemp to fix it (from "The Undocumented
DOS"):
--- builtins.old 2005-10-16 18:57:24.000000000 +0200
+++ builtins.c 2005-10-16 19:17:18.000000000 +0200
@@ -562,10 +562,13 @@
struct coop_com_header *com_header;
struct com_program_entry *com;
int argc;
+ unsigned char *env;
+ unsigned short len;
psp = COM_PSP_ADDR;
mcb = SEG2LINEAR(COM_PSP_SEG - 1);
- com_header = (struct coop_com_header *)((char *)psp + 0x100);
+ env = SEG2LINEAR(COM_PSP_SEG + 0x2C);
+ com_header = (struct coop_com_header *)((char *)psp + 0x100);
if (HI(ax) == 0 && com_header->magic != COM_MAGIC)
return 0;
@@ -587,8 +590,23 @@
/* first parse commandline */
args[0] = strlower(com_strdup(com_getarg0()));
argc = com_argparse(&psp->cmdline_len, &args[1], MAX_ARGS - 1) + 1;
- builtin_name = strlower(com_strdup(mcb->name));
- builtin_name[8] = 0;
+ /* skip environment vars */
+ do
+ env += (len=strlen(env)) + 1;
+ while (len);
+ /* env should point now to the word that contains the number
+ * of strings that follow environment
+ * We check for a reasonable value, with sign since it could
+ * be FFFFh; usually 1
+ */
+ if ((*((signed short *) env) >= 1) && (*((signed short *) env) < 10))
+ {
+ env += sizeof (signed short);
+ builtin_name = strlower(com_strdup(env));
+ builtin_name[8] = 0;
+ }
+ else
+ builtin_name[0] = 0;
/* now set the DOS version */
HI(ax) = 0x30;
The idea is get the PSP owner name from the environment block. The PSP
entry at offset 0x2C contains a pointer to the environment block.
See the format here: http://www.ctyme.com/intr/rb-2682.htm (at botton)
So I tried to skip all environment strings the 00h byte and the word
size to get the prog name, but it failed (again see the comments).
Do you see what's wrong here ??
Regards.
______________________________________________
Renovamos el Correo Yahoo!
Nuevos servicios, más seguridad
http://correo.yahoo.es
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel