The 'system' function will send the 'command' string to the underlying operating system for execution. After execution of the 'command', the 'system' function will return a T result if the 'command' was successful. If the 'command' was not successful, the numeric error code will be returned. Any output from the 'command' execution will not be put in the transcript file.
(system "dir") ; do a PC directory listing (system "mycmd") ; execute a special command
Nyquist: with
Note: This function is an extension of the XLISP system. It is provided in the 'msstuff.c' source code file. If your XLISP system is built for an IBM PC and compatibles or generic MS-DOS, this function will work. If your system is built on UNIX or some other operating system, it is unlikely that these functions will work unless you extend the appropriate 'stuff.c' file [which may be called something different like 'unixstuff.c']. The source that could be put in the appropriate 'stuff.c' file for this extension to work on a UNIX style system is:
/* xsystem - execute a system command */ LVAL xsystem() { char *cmd="COMMAND"; if (moreargs()) cmd = (char *)getstring(xlgastring()); xllastarg(); return (system(cmd) == 0 ? true : cvfixnum((FIXTYPE)errno)); }
The source that gets added to the 'osdefs.h' file is:
extern LVAL xsystem();
The source that gets added to the 'osptrs.h' file is:
{ "SYSTEM", S, xsystem },
See the
system
function in the