Browse Source

+ system.cmdline variable for go32v2 and win32 added

florian 26 years ago
parent
commit
67c66987e5
3 changed files with 25 additions and 5 deletions
  1. 10 1
      rtl/go32v2/system.pp
  2. 5 1
      rtl/inc/systemh.inc
  3. 10 3
      rtl/win32/syswin32.pp

+ 10 - 1
rtl/go32v2/system.pp

@@ -313,6 +313,12 @@ sysseg_move(psp, 128, get_ds, longint(@doscmd), 128);
 {$IfDef SYSTEMDEBUG}
 {$IfDef SYSTEMDEBUG}
 Writeln(stderr,'Dos command line is #',doscmd,'# size = ',length(doscmd));
 Writeln(stderr,'Dos command line is #',doscmd,'# size = ',length(doscmd));
 {$EndIf SYSTEMDEBUG}
 {$EndIf SYSTEMDEBUG}
+
+// setup cmdline variable
+getmem(cmdline,length(doscmd)+1);
+move(doscmd[1],cmdline^,length(doscmd));
+cmdline[length(doscmd)]:=#0;
+
 j := 1;
 j := 1;
 quote := #0;
 quote := #0;
 for i:=1 to length(doscmd) do
 for i:=1 to length(doscmd) do
@@ -1222,7 +1228,10 @@ Begin
 End.
 End.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  1999-03-01 15:40:52  peter
+  Revision 1.7  1999-03-10 22:15:28  florian
+    + system.cmdline variable for go32v2 and win32 added
+
+  Revision 1.6  1999/03/01 15:40:52  peter
     * use external names
     * use external names
     * removed all direct assembler modes
     * removed all direct assembler modes
 
 

+ 5 - 1
rtl/inc/systemh.inc

@@ -106,6 +106,7 @@ const
   fmInOut  = $D7B3;
   fmInOut  = $D7B3;
   fmAppend = $D7B4;
   fmAppend = $D7B4;
   Filemode : byte = 2;
   Filemode : byte = 2;
+  CmdLine : PChar = nil;
 
 
 Type
 Type
   TErrorProc = Procedure (ErrNo : Longint; Address : Pointer);
   TErrorProc = Procedure (ErrNo : Longint; Address : Pointer);
@@ -435,7 +436,10 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.51  1999-03-03 15:23:58  michael
+  Revision 1.52  1999-03-10 22:15:30  florian
+    + system.cmdline variable for go32v2 and win32 added
+
+  Revision 1.51  1999/03/03 15:23:58  michael
   + Added setstring for Delphi compatibility
   + Added setstring for Delphi compatibility
 
 
   Revision 1.50  1999/02/01 00:05:16  florian
   Revision 1.50  1999/02/01 00:05:16  florian

+ 10 - 3
rtl/win32/syswin32.pp

@@ -640,10 +640,10 @@ procedure setup_arguments;
 var
 var
   arglen,
   arglen,
   count   : longint;
   count   : longint;
-  argstart,
-  cmdline : pchar;
+  argstart,scmdline : pchar;
   quote   : set of char;
   quote   : set of char;
   argsbuf : array[0..127] of pchar;
   argsbuf : array[0..127] of pchar;
+
 begin
 begin
 { create commandline, it starts with the executed filename which is argv[0] }
 { create commandline, it starts with the executed filename which is argv[0] }
   cmdline:=GetCommandLine;
   cmdline:=GetCommandLine;
@@ -677,6 +677,8 @@ begin
   { skip quote }
   { skip quote }
     if cmdline^ in quote then
     if cmdline^ in quote then
      inc(longint(cmdline));
      inc(longint(cmdline));
+    if count=0 then
+      scmdline:=cmdline-1;
     inc(count);
     inc(count);
   until false;
   until false;
 { create argc }
 { create argc }
@@ -687,6 +689,8 @@ begin
 { create the argv }
 { create the argv }
   getmem(argv,count shl 2);
   getmem(argv,count shl 2);
   move(argsbuf,argv^,count shl 2);
   move(argsbuf,argv^,count shl 2);
+  // finally setup the abused cmdline variable
+  cmdline:=scmdline;
 end;
 end;
 
 
 
 
@@ -973,7 +977,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.33  1999-01-18 10:05:57  pierre
+  Revision 1.34  1999-03-10 22:15:31  florian
+    + system.cmdline variable for go32v2 and win32 added
+
+  Revision 1.33  1999/01/18 10:05:57  pierre
    + system_exit procedure added
    + system_exit procedure added
 
 
   Revision 1.32  1998/12/28 23:30:11  peter
   Revision 1.32  1998/12/28 23:30:11  peter