SYSTEM_DEBUG_STARTUP used to output args and env at start

This commit is contained in:
pierre 1999-05-04 23:28:40 +00:00
parent b229e83941
commit 2ac48e8ad1

View File

@ -12,8 +12,19 @@
**********************************************************************} **********************************************************************}
unit system; unit system;
interface interface
{ two debug conditionnals can be used
- SYSTEMDEBUG
-for STACK checks
-for non closed files at exit (or at any time with GDB)
- SYSTEM_DEBUG_STARTUP
specifically for
- proxy command line (DJGPP feature)
- list of args
- list of env variables (PM) }
{ include system-independent routine headers } { include system-independent routine headers }
{$I systemh.inc} {$I systemh.inc}
@ -290,6 +301,7 @@ end;
var var
_args : ppchar;external name '_args'; _args : ppchar;external name '_args';
procedure setup_arguments; procedure setup_arguments;
type arrayword = array [0..0] of word; type arrayword = array [0..0] of word;
var psp : word; var psp : word;
@ -306,9 +318,9 @@ psp:=stub_info^.psp_selector;
largs[0]:=dos_argv0; largs[0]:=dos_argv0;
argc := 1; argc := 1;
sysseg_move(psp, 128, get_ds, longint(@doscmd), 128); sysseg_move(psp, 128, get_ds, longint(@doscmd), 128);
{$IfDef SYSTEMDEBUG} {$IfDef SYSTEM_DEBUG_STARTUP}
Writeln(stderr,'Dos command line is #',doscmd,'# size = ',length(doscmd)); Writeln(stderr,'Dos command line is #',doscmd,'# size = ',length(doscmd));
{$EndIf SYSTEMDEBUG} {$EndIf }
// setup cmdline variable // setup cmdline variable
getmem(cmdline,length(doscmd)+1); getmem(cmdline,length(doscmd)+1);
@ -358,9 +370,9 @@ if (argc > 1) and (far_strlen(get_ds,longint(largs[1])) = 6) then
proxy_s[0] := #6; proxy_s[0] := #6;
if (proxy_s = '!proxy') then if (proxy_s = '!proxy') then
begin begin
{$IfDef SYSTEMDEBUG} {$IfDef SYSTEM_DEBUG_STARTUP}
Writeln(stderr,'proxy command line '); Writeln(stderr,'proxy command line ');
{$EndIf SYSTEMDEBUG} {$EndIf SYSTEM_DEBUG_STARTUP}
proxy_argc := atohex(largs[2]); proxy_argc := atohex(largs[2]);
proxy_seg := atohex(largs[3]); proxy_seg := atohex(largs[3]);
proxy_ofs := atohex(largs[4]); proxy_ofs := atohex(largs[4]);
@ -372,9 +384,9 @@ if (argc > 1) and (far_strlen(get_ds,longint(largs[1])) = 6) then
al :=far_strlen(dos_selector, lin); al :=far_strlen(dos_selector, lin);
getmem(largs[i],al+1); getmem(largs[i],al+1);
sysseg_move(dos_selector, lin, get_ds,longint(largs[i]), al+1); sysseg_move(dos_selector, lin, get_ds,longint(largs[i]), al+1);
{$IfDef SYSTEMDEBUG} {$IfDef SYSTEM_DEBUG_STARTUP}
Writeln(stderr,'arg ',i,' #',largs[i],'#'); Writeln(stderr,'arg ',i,' #',largs[i],'#');
{$EndIf SYSTEMDEBUG} {$EndIf SYSTEM_DEBUG_STARTUP}
end; end;
argc := proxy_argc; argc := proxy_argc;
end; end;
@ -416,6 +428,7 @@ end;
var var
__stubinfo : p_stub_info;external name '__stubinfo'; __stubinfo : p_stub_info;external name '__stubinfo';
___dos_argv0 : pchar;external name '___dos_argv0'; ___dos_argv0 : pchar;external name '___dos_argv0';
procedure setup_environment; procedure setup_environment;
var env_selector : word; var env_selector : word;
env_count : longint; env_count : longint;
@ -441,9 +454,9 @@ begin
begin begin
getmem(envp[env_count],strlen(cp)+1); getmem(envp[env_count],strlen(cp)+1);
strcopy(envp[env_count], cp); strcopy(envp[env_count], cp);
{$IfDef SYSTEMDEBUG} {$IfDef SYSTEM_DEBUG_STARTUP}
Writeln(stderr,'env ',env_count,' = "',envp[env_count],'"'); Writeln(stderr,'env ',env_count,' = "',envp[env_count],'"');
{$EndIf SYSTEMDEBUG} {$EndIf SYSTEM_DEBUG_STARTUP}
inc(env_count); inc(env_count);
while (cp^ <> #0) do while (cp^ <> #0) do
inc(longint(cp)); { skip to NUL } inc(longint(cp)); { skip to NUL }
@ -540,7 +553,7 @@ var
{$endif SYSTEMDEBUG} {$endif SYSTEMDEBUG}
begin begin
{$ifdef SYSTEMDEBUG} {$ifdef SYSTEMDEBUG}
for h:=0 to max_files do for h:=0 to max_files-1 do
if openfiles[h] then if openfiles[h] then
writeln(stderr,'file ',opennames[h],' not closed at exit'); writeln(stderr,'file ',opennames[h],' not closed at exit');
{$endif SYSTEMDEBUG} {$endif SYSTEMDEBUG}
@ -1238,7 +1251,10 @@ Begin
End. End.
{ {
$Log$ $Log$
Revision 1.10 1999-04-28 11:42:45 peter Revision 1.11 1999-05-04 23:28:40 pierre
SYSTEM_DEBUG_STARTUP used to output args and env at start
Revision 1.10 1999/04/28 11:42:45 peter
+ FileNameCaseSensetive boolean + FileNameCaseSensetive boolean
Revision 1.9 1999/04/28 06:01:25 florian Revision 1.9 1999/04/28 06:01:25 florian