TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Steven Deller <[log in to unmask]>
Fri, 15 Oct 1999 09:07:58 -0400
text/plain (47 lines)
On Friday, October 15, 1999 5:27 AM, Wretling Urban
[SMTP:[log in to unmask]] wrote:
> Hello!
> I want to execute the cp command on unix to copy a file but cant seem to
> find a good way of solving that. I have tried to look in the online help
> for
> POSIX but haven't found anything (maybe I've looked in the wrong places??).
> If you know how to solve it please reply.
> /Urban

POSIX 1003.1a (I think that is the right update letter) defines a C call for
what you want, namely:
  int system(const char *command)
That invokes the system standard "sh" shell to run the "command" string.  If
invoked with the NULL string, and no shell is available on the system of
interest, the call returns 0 (that is one way to test if the system supports
a standard shell).  The possible error returns are identical to the waitpid()
and fork() calls.

POSIX 1003.5 and 1003.5(b) (the latest I believe) were done against earlier
versions of 1003.1 and thus do not have the system call in a standard Ada

I have started an informal effort to define the additional calls (system is
relatively easy, but even that has some complications with regard to possible
signal interruptions) in a consistent way, and make a *suggestion* that all
vendors of Ada extend their POSIX 1003.5 implementation in a consistent way.

That effort *JUST* started and I was in the process of preparing a more
formal proposal to team-ada.

Your email has jumped the gun a bit.

For your application, just make a simple pragma interface C to the system
call.  If you need more explanation than that, let me know.


Steven Deller, Apex Ada Marketing
[log in to unmask], (410) 757 6924
Rational Software Corporation,
For user email groups, check