From: Luca A. <luc...@em...> - 2003-03-19 15:33:07
|
Hi, On Wed, 2003-03-19 at 15:02, Paolo Gai wrote: > Hi Luca, Hi Giacomo... > > what I really think about this issue is that the whole _startup function > should be customizable by the user. > > That is, if we are using oslib only all remains like that, if we are > using our kernel based on OsLib, we should be able to write our own > _startup functions. > > In fact, if you remove the command line mangling part, it remains only a > bios_save() and a bios_restore(). > > If this way is taken, there is no more need to have the "MAIN" define to > use a predefined OsLib's main() function or the kernel's "init" > function... > > what do you think about that??? the code would be something like the one > in the bottom of the mail... and it seems in my opinion more simple... I think the solution is to have a STARTUP macro in xo.s, instead of a MAIN macro in x1.c... If you think it is ok, I'll commit a change on the cvs. Regarding the original (argv) problem, I'd prefer to commit something like this, if it works ok for you: Index: xlib/x1.c =================================================================== RCS file: /cvsroot/oslib/oslib/xlib/x1.c,v retrieving revision 1.4 diff -r1.4 x1.c 77a78,79 > #define MAX_ARG_SIZE 1024 > static char private_args[MAX_ARG_SIZE]; 102d103 < char *cmdline = (char *)(mbi->cmdline); 111,115c112,118 < while (cmdline[i] != 0) { < _argv[_argc] = &(cmdline[i]); < while (cmdline[i] != ' ' && cmdline[i] != 0) i++; < if (cmdline[i] == ' ') { < cmdline[i] = 0; i++; _argc++; --- > memcpy(private_args, (char *)mbi->cmdline, MAX_ARG_SIZE); > private_args[MAX_ARG_SIZE - 1] = 0; > while (private_args[i] != 0) { > _argv[_argc] = &(private_args[i]); > while (private_args[i] != ' ' && private_args[i] != 0) i++; > if (private_args[i] == ' ') { > private_args[i] = 0; i++; _argc++; Luca |