The high-level procedure Getopt did not expose a feature of its lowlevel
counterpart, namely the Concatenate option which modifies the behavior of the
command line parser. This patch adds this option to the high-level interface.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-09-02  Johannes Kanig  <ka...@adacore.com>

        * g-comlin.adb (Getopt): New optional argument Concatenate to have
        similar interface as the other Getopt function.

Index: g-comlin.adb
===================================================================
--- g-comlin.adb        (revision 178435)
+++ g-comlin.adb        (working copy)
@@ -3236,9 +3236,10 @@
    ------------
 
    procedure Getopt
-     (Config   : Command_Line_Configuration;
-      Callback : Switch_Handler := null;
-      Parser   : Opt_Parser     := Command_Line_Parser)
+     (Config      : Command_Line_Configuration;
+      Callback    : Switch_Handler := null;
+      Parser      : Opt_Parser := Command_Line_Parser;
+      Concatenate : Boolean := True)
    is
       Getopt_Switches : String_Access;
       C               : Character := ASCII.NUL;
@@ -3373,7 +3374,7 @@
 
       loop
          C := Getopt (Switches    => Getopt_Switches.all,
-                      Concatenate => True,
+                      Concatenate => Concatenate,
                       Parser      => Parser);
 
          if C = '*' then
Index: g-comlin.ads
===================================================================
--- g-comlin.ads        (revision 178435)
+++ g-comlin.ads        (working copy)
@@ -703,9 +703,10 @@
    --  switch.
 
    procedure Getopt
-     (Config   : Command_Line_Configuration;
-      Callback : Switch_Handler := null;
-      Parser   : Opt_Parser := Command_Line_Parser);
+     (Config      : Command_Line_Configuration;
+      Callback    : Switch_Handler := null;
+      Parser      : Opt_Parser := Command_Line_Parser;
+      Concatenate : Boolean := True);
    --  Similar to the standard Getopt function.
    --  For each switch found on the command line, this calls Callback, if the
    --  switch is not handled automatically.
@@ -716,6 +717,9 @@
    --  variable). This function will in fact never call [Callback] if all
    --  switches were handled automatically and there is nothing left to do.
    --
+   --  The option Concatenate is identical to the one of the standard Getopt
+   --  function.
+   --
    --  This procedure automatically adds -h and --help to the valid switches,
    --  to display the help message and raises Exit_From_Command_Line.
    --  If an invalid switch is specified on the command line, this procedure

Reply via email to