Menu

[r244]: / trunk / demos / Source / show_commandline_3.adb  Maximize  Restore  History

Download this file

66 lines (52 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
-- {{Ada/Sourceforge|show_commandline_3.adb}}
pragma License (Gpl);
pragma Ada_95;
with Ada.Text_IO;
with Ada.Command_Line;
with Ada.Strings.Bounded;
procedure Show_Commandline_3 is
package T_IO renames Ada.Text_IO;
package CL renames Ada.Command_Line;
function Max_Lenght
(Value_1 : Integer;
Value_2 : Integer)
return Integer;
function Max_Lenght
(Value_1 : Integer;
Value_2 : Integer)
return Integer
is
Retval : Integer;
begin
if Value_1 > Value_2 then
Retval := Value_1;
else
Retval := Value_2;
end if;
return Retval;
end Max_Lenght;
pragma Inline (Max_Lenght);
package SB is new Ada.Strings.Bounded.Generic_Bounded_Length (
Max => Max_Lenght
(Value_1 => CL.Argument (1)'Length,
Value_2 => CL.Argument (2)'Length));
X : SB.Bounded_String :=
SB.To_Bounded_String (CL.Argument (1));
begin
T_IO.Put ("Argument 1 = ");
T_IO.Put_Line (SB.To_String (X));
X := SB.To_Bounded_String (CL.Argument (2));
T_IO.Put ("Argument 2 = ");
T_IO.Put_Line (SB.To_String (X));
end Show_Commandline_3;
----------------------------------------------------------------------------
-- $Author$
--
-- $Revision$
-- $Date$
--
-- $Id$
-- $HeadURL$
----------------------------------------------------------------------------
-- vim: textwidth=0 nowrap tabstop=8 shiftwidth=3 softtabstop=3 expandtab
-- vim: filetype=ada encoding=utf-8 fileformat=unix foldmethod=indent