TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

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

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

Print Reply
"David C. Hoos" <[log in to unmask]>
Reply To:
David C. Hoos
Fri, 15 Oct 1999 11:38:01 -0500
text/plain (61 lines)
----- Original Message -----
From: Mike Brenner <[log in to unmask]>
To: <[log in to unmask]>
Sent: Friday, October 15, 1999 9:33 AM
Subject: Re: How do I copy a file

> Wretling Urban> I want to execute the cp command on unix to copy a
> file ...
> Steve Deller > 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"
> > POSIX 1003.5 and 1003.5(b) (the latest I believe) were done against
> > versions of 1003.1 and thus do not have the system call in a standard
> > format ... For your application, just make a simple pragma interface C
to the system
> > call.  If you need more explanation than that, let me know.
> Doing system calls in an operating system manner has always been
> problematical for me. I would appreciate pointers to further
> explanations of the following:
>   (a) What if you want the csh instead of the sh?
You use the string "csh -c <single-argument>"  (see the man page for csh)

>   (b) Is there a chart where to download or purchase a Posix binding
> for each Ada compiler?
For UNIX flavors (including Linux):

For Win32 (less complete, but useful):

>   (c) Is there a chart that shows which calls are compatible between
> Linux and NT 4.0 Service Pack 5?
Not that I know of

>   (d) Is there a chart that shows which calls are compatible between
> Linux and Solaris 2.6?
Not that I know of

>   (e) Is there documentation showing (in the example of the cp
> command) the difference between various possible error conditions
> such as (1) the cp command does not exist, (2) the cp command was
> available but privacy controls prevent executing it, (3) the cp
> command failed due to problems with the source file (e.g. file not
> found), (4) the cp command failed due to problems with the target
> file (e.g. disk full).
Yes, the man pages for cp, and system tell what the return codes
are for various conditions.