Commit ffdbd4c4 by Joel Brobecker Committed by Arnaud Charlet

g-comlin.adb (Getopt): Skip any leading space in the Switches string.

2005-06-14  Joel Brobecker  <brobecker@adacore.com>

	* g-comlin.adb (Getopt): Skip any leading space in the Switches string.
	Avoids a CE when it starts with spaces.

From-SVN: r101038
parent a49c3e16
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2004 Free Software Foundation, Inc. --
-- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -384,11 +384,19 @@ package body GNAT.Command_Line is
Arg : String renames CL.Argument (Current_Argument);
Index_Switches : Natural := 0;
Max_Length : Natural := 0;
Index : Natural := Switches'First;
Index : Natural;
Length : Natural := 1;
End_Index : Natural;
begin
-- Remove all leading spaces first to make sure that Index points
-- at the start of the first switch.
Index := Switches'First;
while Index <= Switches'Last and then Switches (Index) = ' ' loop
Index := Index + 1;
end loop;
while Index <= Switches'Last loop
-- Search the length of the parameter at this position in Switches
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment