SYS-CALL

make a system call to the host operating system
Major Section:  PROGRAMMING

Example Forms:
(sys-call "cp" '("foo.lisp" "foo-copied.lisp"))
(prog2$ (sys-call "cp" '("foo.lisp" "foo-copied.lisp"))
        (sys-call-status state))
(prog2$ (sys-call "cp foo.lisp foo-copied.lisp" nil)
        (sys-call-status state))
The first argument of sys-call is a command for the host operating system, and the second argument is a list of strings that are the arguments for that command. In many lisps (including GCL and Allegro CL) you can put the arguments with the command, as shown in the last example above.

The use of prog2$ above is optional, but illustrates a typical sort of use when one wishes to get the return status. See sys-call-status.

General Form:
(sys-call cmd args)
This function logically returns nil. However, it makes the indicated call to the host operating system, as described above, using a function supplied ``under the hood'' by the underlying Lisp system. On occasions where one wishes to obtain the numeric status returned by the host operating system (or more precisely, by the Lisp function under the hood that passes the system call to the host operating system), one may do so; see sys-call-status. The status value is the value returned by that Lisp function, which may well be the same numeric value returned by the host operating system for the underlying system call.

Note that sys-call does not touch the ACL2 state; however, sys-call-status updates the file-clock field of the state. One may view that update as modifying the fileclock to be at least as recent as the time of the most recent sys-call./