From: Brian May <bam@snoopy.apana.org.au>
Subject: Re: problem with command line
Date: Thu, 11 Jan 2007 20:02:22 +1100
Date: 2007-01-11T20:02:22+11:00 [thread overview]
Message-ID: <sa4bql6kkbl.fsf@margay.local> (raw)
In-Reply-To: NP6dnV2JMLKiFDjYnZ2dnUVZ_vupnZ2d@rcn.net
>>>>> "Frank" == Frank J Lhota <FrankLho.NOSPAM@rcn.com> writes:
Frank> I would probably code your application something like this:
Frank> if Argument_Count >= 1 then
Frank> Nome1 := To_Unbounded_String(Argument(1));
Frank> else
Frank> Nome1 := To_Unbounded_String("Default_Nome1");
Frank> end if;
Frank> if Argument_Count >= 2 then
Frank> Nome2 := To_Unbounded_String(Argument(2));
Frank> else
Frank> Nome2 := To_Unbounded_String("Default_Nome2");
Frank> end if;
Frank> ...
Probably less usable (actually I can't see any applications that don't
have a messed up command line interface), but I think the following
would also work:
=== cut ===
with Ada.Command_Line;
use Ada.Command_Line;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
procedure Test is
Nome1 : Unbounded_String;
Nome2 : Unbounded_String;
begin
if Argument_Count >= 2 then
declare
Nome1 : String := Argument (1);
Nome2 : String := Argument (2);
begin
...
end
elsif Argument_Count = 1
declare
Nome1 : String := Argument (1);
begin
...
end
else
...
end if;
...
end Test;
=== cut ===
Disclaimer: I program in different languages, lets hope I got the
syntax right ;-)
--
Brian May <bam@snoopy.apana.org.au>
next prev parent reply other threads:[~2007-01-11 9:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-11 0:08 problem with command line [Taz]
2007-01-11 0:47 ` Frank J. Lhota
2007-01-11 9:02 ` Brian May [this message]
2007-01-11 10:39 ` Martin Krischik
2007-01-11 0:51 ` Jeffrey Creem
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox