* GNAT and Command Line Arguments
@ 1994-10-19 14:32 Jim Rogers
1994-10-19 15:56 ` Magnus Kempe
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Jim Rogers @ 1994-10-19 14:32 UTC (permalink / raw)
Hi all.
I am using GNAT to learn more about the features of Ada9X (and Ada in general).
I am working up a proposal to have our division's R&D lab move from C based
languages (C & C++) to Ada.
My current question:
How do I write an Ada program so that I can pass file names in from the
UNIX command line? I am running GNAT under HPUX.
--
------------------------------------------------------------------------------
| Jim Rogers | Dead Reckoning: |
| Hewlett-Packard Company | Traditional form of rough-estimate |
| Colorado Springs Division | navigation used for hundreds of years by |
| | sailors, almost all of whom are dead. |
| jimr@col.hp.com | |
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GNAT and Command Line Arguments
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
@ 1994-10-19 15:56 ` Magnus Kempe
1994-10-19 16:51 ` Bob Duff
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Magnus Kempe @ 1994-10-19 15:56 UTC (permalink / raw)
jimr@col.hp.com (Jim Rogers) writes:
:
: How do I write an Ada program so that I can pass file names in from the
: UNIX command line? I am running GNAT under HPUX.
It's part of the predefined language environment in Ada 9X:
A.15 "The Package Command_Line".
Just verified; it is implemented in GNAT.
--
Magnus Kempe "I know not what course others may take, but as for me,
Magnus.Kempe@di.epfl.ch Give me Liberty... or give me Death!" -- Patrick Henry
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GNAT and Command Line Arguments
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
1994-10-19 15:56 ` Magnus Kempe
@ 1994-10-19 16:51 ` Bob Duff
1994-10-19 17:28 ` paus
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bob Duff @ 1994-10-19 16:51 UTC (permalink / raw)
In article <383amh$95h@hp-col.col.hp.com>, Jim Rogers <jimr@col.hp.com> wrote:
>How do I write an Ada program so that I can pass file names in from the
>UNIX command line? I am running GNAT under HPUX.
Check out the package Command_Line, in RM9X-A.15;5.0. I don't know if
GNAT currently supports it, yet. The semantics of Command_Line are
somewhat implemenation defined, of course, since different operating
systems have different notions of command lines.
- Bob
--
Bob Duff bobduff@inmet.com
Oak Tree Software, Inc.
Ada 9X Mapping/Revision Team (Intermetrics, Inc.)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GNAT and Command Line Arguments
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
1994-10-19 15:56 ` Magnus Kempe
1994-10-19 16:51 ` Bob Duff
@ 1994-10-19 17:28 ` paus
1994-10-19 17:29 ` paus
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paus @ 1994-10-19 17:28 UTC (permalink / raw)
In article <383amh$95h@hp-col.col.hp.com> jimr@col.hp.com (Jim Rogers) writes:
>
> My current question:
>
> How do I write an Ada program so that I can pass file names in from the
> UNIX command line? I am running GNAT under HPUX.
>
Just use the RTL package Ada.Command_Line. It's built into GNAT and it is
standard now in Ada9X.
--
|----------------------------------------------------------------------|
|Dipl.-Ing. Michael Paus (Member: Team Ada) |
|University of Stuttgart, Inst. of Flight Mechanics and Flight Control |
|Forststrasse 86, 70176 Stuttgart, Germany |
|Phone: (+49) 711-121-1434 FAX: (+49) 711-634856 |
|Email: Michael.Paus@ifr.luftfahrt.uni-stuttgart.de (NeXT-Mail welcome)|
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GNAT and Command Line Arguments
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
` (2 preceding siblings ...)
1994-10-19 17:28 ` paus
@ 1994-10-19 17:29 ` paus
1994-10-19 17:30 ` paus
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paus @ 1994-10-19 17:29 UTC (permalink / raw)
In article <383amh$95h@hp-col.col.hp.com> jimr@col.hp.com (Jim Rogers) writes:
>
> How do I write an Ada program so that I can pass file names in from the
> UNIX command line? I am running GNAT under HPUX.
>
Just use the RTL package Ada.Command_Line. It's built into GNAT and it is
standard now in Ada9X.
|----------------------------------------------------------------------|
|Dipl.-Ing. Michael Paus (Member: Team Ada) |
|University of Stuttgart, Inst. of Flight Mechanics and Flight Control |
|Forststrasse 86, 70176 Stuttgart, Germany |
|Phone: (+49) 711-121-1434 FAX: (+49) 711-634856 |
|Email: Michael.Paus@ifr.luftfahrt.uni-stuttgart.de (NeXT-Mail welcome)|
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GNAT and Command Line Arguments
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
` (3 preceding siblings ...)
1994-10-19 17:29 ` paus
@ 1994-10-19 17:30 ` paus
1994-10-19 17:32 ` paus
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paus @ 1994-10-19 17:30 UTC (permalink / raw)
In article <383amh$95h@hp-col.col.hp.com> jimr@col.hp.com (Jim Rogers) writes:
> How do I write an Ada program so that I can pass file names in from the
> UNIX command line? I am running GNAT under HPUX.
Just use the RTL package Ada.Command_Line. It's built into GNAT and it is
standard now in Ada9X.
|----------------------------------------------------------------------|
|Dipl.-Ing. Michael Paus (Member: Team Ada) |
|University of Stuttgart, Inst. of Flight Mechanics and Flight Control |
|Forststrasse 86, 70176 Stuttgart, Germany |
|Phone: (+49) 711-121-1434 FAX: (+49) 711-634856 |
|Email: Michael.Paus@ifr.luftfahrt.uni-stuttgart.de (NeXT-Mail welcome)|
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GNAT and Command Line Arguments
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
` (4 preceding siblings ...)
1994-10-19 17:30 ` paus
@ 1994-10-19 17:32 ` paus
1994-10-19 18:58 ` Robert Dewar
1994-10-20 11:11 ` Robb Nebbe
7 siblings, 0 replies; 9+ messages in thread
From: paus @ 1994-10-19 17:32 UTC (permalink / raw)
In article <383amh$95h@hp-col.col.hp.com> jimr@col.hp.com (Jim Rogers) writes:
> How do I write an Ada program so that I can pass file names in from the
> UNIX command line? I am running GNAT under HPUX.
Just use the RTL package Ada.Comnand_Line. It's built into GNAT and it
is standard now in Ada9X.
--
|----------------------------------------------------------------------|
|Dipl.-Ing. Michael Paus (Member: Team Ada) |
|University of Stuttgart, Inst. of Flight Mechanics and Flight Control |
|Forststrasse 86, 70176 Stuttgart, Germany |
|Phone: (+49) 711-121-1434 FAX: (+49) 711-634856 |
|Email: Michael.Paus@ifr.luftfahrt.uni-stuttgart.de (NeXT-Mail welcome)|
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GNAT and Command Line Arguments
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
` (5 preceding siblings ...)
1994-10-19 17:32 ` paus
@ 1994-10-19 18:58 ` Robert Dewar
1994-10-20 11:11 ` Robb Nebbe
7 siblings, 0 replies; 9+ messages in thread
From: Robert Dewar @ 1994-10-19 18:58 UTC (permalink / raw)
first, the usual reminder, if you want to ask questions about gnat, be sure
to at least copy them to gnat-report, where the gnat team stands ready to
help, but can only help if it sees the questions!
as to the particular question, there is a defined command line package in
Ada 9X. THe easiest way for you to get the spec is to look at file
a-comlin.ads in your GNAT library which has a copy of the spec which is
quite well commented, and should be adeqaute for your purposes.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GNAT and Command Line Arguments
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
` (6 preceding siblings ...)
1994-10-19 18:58 ` Robert Dewar
@ 1994-10-20 11:11 ` Robb Nebbe
7 siblings, 0 replies; 9+ messages in thread
From: Robb Nebbe @ 1994-10-20 11:11 UTC (permalink / raw)
In article <383amh$95h@hp-col.col.hp.com>, jimr@col.hp.com (Jim Rogers) writes:
|>
|> My current question:
|>
|> How do I write an Ada program so that I can pass file names in from the
|> UNIX command line? I am running GNAT under HPUX.
|>
The relevant functions from Ada.Command_Line are the following:
function Argument_Count return Natural;
function Argument( Number : in Positive ) return String;
function Command_Name return String;
A loop printing out all the command line arguments would be:
for Index in 1 .. Argument_Count loop
Text_IO.Put_Line( Argument( Index ));
end loop;
The interface is a little cleaner than what you get in C since
the command name, which a system may or may not provide, is not
considered as one of the arguments.
- Robb Nebbe
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~1994-10-20 11:11 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-10-19 14:32 GNAT and Command Line Arguments Jim Rogers
1994-10-19 15:56 ` Magnus Kempe
1994-10-19 16:51 ` Bob Duff
1994-10-19 17:28 ` paus
1994-10-19 17:29 ` paus
1994-10-19 17:30 ` paus
1994-10-19 17:32 ` paus
1994-10-19 18:58 ` Robert Dewar
1994-10-20 11:11 ` Robb Nebbe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox