Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ada.command_line.set_exit_status_example_source [2012/01/14 20:34] (current)
thomaslocke created
Line 1: Line 1:
 +<code ada>
 +with Ada.Text_IO;​
 +with Ada.Command_Line;​
 +
 +procedure Args is
 +   ​package IO renames Ada.Text_IO;​
 +   ​package CLI renames Ada.Command_Line;​
 +   ​More_Than_One_Arg : constant CLI.Exit_Status := 3;
 +begin
 +   ​IO.Put_Line (Item => "​Argument Count:"​ & CLI.Argument_Count'​Img);​
 +   if CLI.Argument_Count = 0 then
 +      CLI.Set_Exit_Status (Code => CLI.Failure);​
 +   elsif CLI.Argument_Count = 1 then
 +      CLI.Set_Exit_Status (Code => CLI.Success);​
 +   else
 +      CLI.Set_Exit_Status (Code => More_Than_One_Arg);​
 +   end if; 
 +end Args;
 +</​code>​
 +
 +[[Ada.Command_Line#​Ada.Command_Line.Set_Exit_Status | Go back]]
  

Navigation