comp.lang.ada
 help / color / mirror / Atom feed
From: "bklungle" <bklungle@ix.netcom.com>
Subject: Re: comand line arguments
Date: 1997/10/10
Date: 1997-10-10T01:23:27-05:00	[thread overview]
Message-ID: <01bcd545$f326d780$68491ecc@p5120> (raw)
In-Reply-To: 343D6FC1.7B3B@unx1.shsu.edu


Here is a little something I played around with a while ago.
Just a quick hack.

cheers...bob


with ada.command_line;
with fibonacci;
with text_io;

procedure fib is

  package acl renames ada.command_line;
  package txo renames text_io;

  package iio is new txo.integer_io(integer);

  function argc return natural renames acl.argument_count;
  function argv(Nr : positive) return string renames acl.argument;

  n : integer;
begin
  if argc = 1 then
    n := integer'value(argv(1));
    if n >= 0 then
      txo.put("fib(");
      iio.put(n, 1);
      txo.put(") is ");
      iio.put(fibonacci.fib(n), 1);
      txo.new_line;
      txo.new_line;
    else
      txo.put_line("number must be >= 0");
    end if;
  end if;
exception
  when others =>
    txo.put_line("fib: unknown exception");
    raise;
end fib;


ucs_rat@shsu.edu wrote in article <343D6FC1.7B3B@unx1.shsu.edu>...
> Could some one give me a quick snibbit of code to do simple command line
> aruguments in GNAT Ada95.  IF there are any necessary with and use
> declartions would you let me know about them too?  It doesn't have to be
> complex just some basic commands that cuold be done from batches...just
> would rather wrapp is all up in one tight ada program.  
> 
> Thanks for the help,
> 
> Robert A. Thompson
> 




  parent reply	other threads:[~1997-10-10  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-09  0:00 comand line arguments ucs_rat
1997-10-10  0:00 ` Pascal Obry
1997-10-10  0:00 ` bklungle [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-10-13  0:00 Marin David Condic, 561.796.8997, M/S 731-96
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox