This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] fix handling of "*" in gnat.command_line


Tested on i686-linux, committed on trunk

Running the following program with "./comlin -EH" should return
"Other switch: -EH", not an error for an invalid switch
with Ada.Text_IO;
with GNAT.Command_Line;
 procedure ComLin is
 begin
   GNAT.Command_Line.Initialize_Option_Scan;
   loop
      begin
         case GNAT.Command_Line.Getopt ("* E H", Concatenate => False) is
            when ASCII.NUL =>
               exit;
            when 'E' =>
               Ada.Text_IO.Put_Line ("Switch E found");
            when 'H' =>
               Ada.Text_IO.Put_Line ("Switch H found");
            when '*' =>
               Ada.Text_IO.Put_Line
                 ("Another switch found: " & GNAT.Command_Line.Full_Switch);
            when others =>
               raise Program_Error;
         end case;
      exception
            when GNAT.Command_Line.Invalid_Switch =>
               Ada.Text_IO.Put_Line
                 ("Invalid switch " & GNAT.Command_Line.Full_Switch);
            when GNAT.Command_Line.Invalid_Parameter =>
               Ada.Text_IO.Put_Line
                 ("Missing parameter for switch  " &
                  GNAT.Command_Line.Full_Switch);
      end;
   end loop;
 end ComLin;

2007-08-14  Emmanuel Briot  <briot@adacore.com>

	* g-comlin.adb (Getopt): Fix handling of "*" switch when not collapsing
	switches.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]