TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
X-To: Steven Deller <[log in to unmask]>
Date: Fri, 15 Oct 1999 17:09:44 -0500
Reply-To: "David C. Hoos" <[log in to unmask]>
From: "David C. Hoos" <[log in to unmask]>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="iso-8859-1"
Organization: Coleman Research Coprporation
MIME-Version: 1.0
Parts/Attachments: text/plain (49 lines)
----- Original Message -----
From: Steven Deller <[log in to unmask]>
To: <[log in to unmask]>
Sent: Friday, October 15, 1999 11:35 AM
Subject: Re: How do I copy a file


> On Friday, October 15, 1999 10:33 AM, Mike Brenner [SMTP:[log in to unmask]]
> wrote:
> > 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"
> string...
> > >
> > > 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
> > > 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?
>
> Not possible through POSIX.
>
Not correct.  You issue the command string
"csh -c <single-parameter>", so the "sh" shell executes
csh with the appropriate single string parameter -- i.e.,
quoting, or escaping, or whatever to make the string
passed to csh a single parameter as far as sh is concerned.
Then csh will parse that single string.

For a concrete example "csh -c 'cp file_a file_b'"

or  "csh -c cp\ file_a\\ file_b"

I do this all the time (with tcsh), because I find the
syntax of tcsh/csh easier to rememeber than the Bourne Shell.

ATOM RSS1 RSS2