----- 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" 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? > 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): http://www.cs.fsu.edu/~baker/ftp/pub/PART/FLORIST/ For Win32 (less complete, but useful): http://ourworld.compuserve.com/homepages/pascal_obry/w32posix.html > (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.