comp.lang.ada
 help / color / mirror / Atom feed
* Re: HELP: how to get parameters given to an exe ?
  1997-03-26  0:00 HELP: how to get parameters given to an exe ? Ingrid CHESSEL & David EXCOFFIER
@ 1997-03-26  0:00 ` Nick Roberts
  1997-03-26  0:00 ` Tom Moran
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Nick Roberts @ 1997-03-26  0:00 UTC (permalink / raw)




Ingrid CHESSEL & David EXCOFFIER <linfo14@univ-savoie.fr> wrote in article
<Pine.SOL.3.95.970326130156.12841A-100000@java>...
> I'd want to code in Ada83 to following thing:
> 
> I wan't the user be able to pass parameters after the name of the exe
file
> i wrote.
> 
> e.g.:  myprog arg1 arg2 ...
> 
> like in Unix: ls -l    (i want to get this "-l") parmeter
>      or Dos:  dir a:   ( the "a:")
> 
> Is there a possibility to code this kinda thing in Ada 83, under Unix ???
> 
> (I think under Unix or dos, the code in Ada might be the same...)

Your Ada compiler manual should give you information on how to do this.
Perhaps in (the now infamous) 'Appendix F'. This is something which is
likely to be implementation dependent.

The information in your manual may give you only half the solution, such as
"the program invocation string can be retrieved by making a call to ..."
for example. You may need to program your own extra functionality in order
to get the behaviour you require (e.g., following the previous example,
separating out the parameters by finding spaces in the invocation string).
In this case, you should ENCAPSULATE the code which gives this extra
functionality (in a subprogram or package), and make sure that the
interface to this module is well defined. Then, in order to port to another
implementation, you need only change the module; everything else can stay
the same (providing you keep to the rules of the interface). See also: the
thread on "FORTRAN's Equivalence".

Nick.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HELP: how to get parameters given to an exe ?
  1997-03-26  0:00 HELP: how to get parameters given to an exe ? Ingrid CHESSEL & David EXCOFFIER
  1997-03-26  0:00 ` Nick Roberts
@ 1997-03-26  0:00 ` Tom Moran
  1997-03-27  0:00 ` Bob Klungle
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Tom Moran @ 1997-03-26  0:00 UTC (permalink / raw)



There's not a standard way in Ada 83 to get the things on the command
line.  Check your compiler's vendor supplied libraries.  They are pretty
sure to contain some way to do it.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* HELP: how to get parameters given to an exe ?
@ 1997-03-26  0:00 Ingrid CHESSEL & David EXCOFFIER
  1997-03-26  0:00 ` Nick Roberts
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Ingrid CHESSEL & David EXCOFFIER @ 1997-03-26  0:00 UTC (permalink / raw)



I'd want to code in Ada83 to following thing:

I wan't the user be able to pass parameters after the name of the exe file
i wrote.

e.g.:  myprog arg1 arg2 ...

like in Unix: ls -l    (i want to get this "-l") parmeter
     or Dos:  dir a:   ( the "a:")

Is there a possibility to code this kinda thing in Ada 83, under Unix ???

(I think under Unix or dos, the code in Ada might be the same...)

TTTIA.


-----------------------------------
Ingrid CHESSEL
David EXCOFFIER

Licence d'informatique

email: linfo14@java.univ-savoie.fr
----------------------------------





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HELP: how to get parameters given to an exe ?
  1997-03-26  0:00 HELP: how to get parameters given to an exe ? Ingrid CHESSEL & David EXCOFFIER
                   ` (2 preceding siblings ...)
  1997-03-27  0:00 ` Bob Klungle
@ 1997-03-27  0:00 ` Gabriel Bereny
  1997-03-28  0:00 ` David C. Hoos, Sr.
  4 siblings, 0 replies; 7+ messages in thread
From: Gabriel Bereny @ 1997-03-27  0:00 UTC (permalink / raw)



Ingrid CHESSEL & David EXCOFFIER (linfo14@univ-savoie.fr) wrote:
: I'd want to code in Ada83 to following thing:

: I wan't the user be able to pass parameters after the name of the exe file
: i wrote.

: e.g.:  myprog arg1 arg2 ...

: like in Unix: ls -l    (i want to get this "-l") parmeter
:      or Dos:  dir a:   ( the "a:")

: Is there a possibility to code this kinda thing in Ada 83, under Unix ???

: (I think under Unix or dos, the code in Ada might be the same...)

If you have POSIX bindings available, use the function 
Posix_Process_Environment.Argument_List to get the list of arguments
and then the string list operations in the package Posix to
manipulate the list and extract the arguments which interest you.

Gabriel Bereny
Rational Software Corporation




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HELP: how to get parameters given to an exe ?
  1997-03-26  0:00 HELP: how to get parameters given to an exe ? Ingrid CHESSEL & David EXCOFFIER
  1997-03-26  0:00 ` Nick Roberts
  1997-03-26  0:00 ` Tom Moran
@ 1997-03-27  0:00 ` Bob Klungle
  1997-03-27  0:00 ` Gabriel Bereny
  1997-03-28  0:00 ` David C. Hoos, Sr.
  4 siblings, 0 replies; 7+ messages in thread
From: Bob Klungle @ 1997-03-27  0:00 UTC (permalink / raw)



> 
> I wan't the user be able to pass parameters after the name of the exe
file
> i wrote.
> 
> e.g.:  myprog arg1 arg2 ...
> 
> like in Unix: ls -l    (i want to get this "-l") parmeter
>      or Dos:  dir a:   ( the "a:")
> 
> Is there a possibility to code this kinda thing in Ada 83, under Unix ???
> 
> (I think under Unix or dos, the code in Ada might be the same...)
> 
> TTTIA.

Verdix (now Rational) Ada'83 does in fact have a command-line interface.
Read the Verdix docs. If you need, I can send an implementation I have.

cheers...bob




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HELP: how to get parameters given to an exe ?
  1997-03-26  0:00 HELP: how to get parameters given to an exe ? Ingrid CHESSEL & David EXCOFFIER
                   ` (3 preceding siblings ...)
  1997-03-27  0:00 ` Gabriel Bereny
@ 1997-03-28  0:00 ` David C. Hoos, Sr.
  1997-03-28  0:00   ` Robert Dewar
  4 siblings, 1 reply; 7+ messages in thread
From: David C. Hoos, Sr. @ 1997-03-28  0:00 UTC (permalink / raw)



First, you must realize that the DOS and UNIX command interpreters (Shells)
will not pass the same thing to the executable program, even for identical
command lines if the command lines contain wildcard file specifications. 
In UNIX, for example, the command line argument *.txt will be expanded to
the list of filenames in the current directory satisfying the wildcard file
specification, while the DOS command interpreter (including Windows 95 and
Windows NT) will simply pass the *.txt to the executable.

In Ada 83, since the LRM does not specify this feature, each compiler
vendor was free to do as he pleased.  The various solutions are not
portable between compilers.

In Ada95, though, the language defines the interface, and in the case of
gnat, at least, the wildcards are expanded by the compiler's implementation
of the LRM's specification.

-- 
David C. Hoos, Sr.,
http://www.dbhwww.com
http://www.ada95.com

Ingrid CHESSEL & David EXCOFFIER <linfo14@univ-savoie.fr> wrote in article
<Pine.SOL.3.95.970326130156.12841A-100000@java>...
> I'd want to code in Ada83 to following thing:
> 
> I wan't the user be able to pass parameters after the name of the exe
file
> i wrote.
> 
> e.g.:  myprog arg1 arg2 ...
> 
> like in Unix: ls -l    (i want to get this "-l") parmeter
>      or Dos:  dir a:   ( the "a:")
> 
> Is there a possibility to code this kinda thing in Ada 83, under Unix ???
> 
> (I think under Unix or dos, the code in Ada might be the same...)
> 
> TTTIA.
> 
> 
> -----------------------------------
> Ingrid CHESSEL
> David EXCOFFIER
> 
> Licence d'informatique
> 
> email: linfo14@java.univ-savoie.fr
> ----------------------------------
> 
> 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HELP: how to get parameters given to an exe ?
  1997-03-28  0:00 ` David C. Hoos, Sr.
@ 1997-03-28  0:00   ` Robert Dewar
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Dewar @ 1997-03-28  0:00 UTC (permalink / raw)



David Hoos says

<<In Ada95, though, the language defines the interface, and in the case of
gnat, at least, the wildcards are expanded by the compiler's implementation
of the LRM's specification.>>

This expansion is not part of the LRM spec, and it is not part of the GNAT
spec, whether it happens depends on the operating system.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1997-03-28  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-26  0:00 HELP: how to get parameters given to an exe ? Ingrid CHESSEL & David EXCOFFIER
1997-03-26  0:00 ` Nick Roberts
1997-03-26  0:00 ` Tom Moran
1997-03-27  0:00 ` Bob Klungle
1997-03-27  0:00 ` Gabriel Bereny
1997-03-28  0:00 ` David C. Hoos, Sr.
1997-03-28  0:00   ` Robert Dewar

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