The Ada Program: args.adb

  1 -- args.adb:  simple program illustraing use of command line package
  2 
  3 with
  4   Ada.Command_Line,     -- access to external execution env (Ada95 A.15)
  5   Ada.Text_IO,          -- usual text (Latin 1) input/output (A.10.1)
  6   Ada.Integer_Text_IO;  -- preinstantiated generic for Integer IO
  7 use Ada;
  8 
  9 procedure Args is
 10    C : constant Natural := Command_Line.Argument_Count;
 11 begin
 12    for I in 1..C loop
 13       Text_IO.Put ("args[");
 14       Integer_Text_IO.Put (Item=>I, Width=>1);
 15       Text_IO.Put ("] = ");
 16       Text_IO.Put_Line (Command_Line.Argument (I));
 17    end loop;
 18 end;