From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b46d62f4a7f83cd9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: Brian May Newsgroups: comp.lang.ada Subject: Re: problem with command line References: <45a58068$0$3828$5402220f@news.sunrise.ch> Date: Thu, 11 Jan 2007 20:02:22 +1100 Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:0cvJAoOTyyu2Imi4cQBOuZywA9I= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: snoopy.microcomaustralia.com.au X-Trace: quokka.wn.com.au 1168506119 202.173.153.89 (11 Jan 2007 18:01:59 +0800) X-Complaints-To: abuse@westnet.com.au Path: g2news2.google.com!news2.google.com!news.germany.com!texta.sil.at!quokka.wn.com.au!not-for-mail Xref: g2news2.google.com comp.lang.ada:8108 Date: 2007-01-11T20:02:22+11:00 List-Id: >>>>> "Frank" == Frank J Lhota 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