Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.



type: function (subr) 
location: system extenstion
source file: msstuff.c and osdefs.h and osptrs.h
Common LISP compatible: no
supported on: MS-DOS compatibles


(system <command> )
        <command>       -       the OS command string to be executed


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

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());
    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 },

Go to the first, previous, next, last section, table of contents.