Annotation of 43BSD/contrib/icon/functions/system.c, revision 1.1.1.1

1.1       root        1: #include "../h/rt.h"
                      2: 
                      3: /*
                      4:  * system(s) - execute string s as a system command.
                      5:  */
                      6: 
                      7: Xsystem(nargs, arg1, arg0)
                      8: int nargs;
                      9: struct descrip arg1, arg0;
                     10:    {
                     11:    char sbuf[MAXSTRING];
                     12: 
                     13:    DeRef(arg1)
                     14: 
                     15:    /*
                     16:     * s must be string and smaller than MAXSTRING characters long.
                     17:     */
                     18:    if (!QUAL(arg1) || STRLEN(arg1) < 0)
                     19:       runerr(103, &arg1);
                     20:    if (STRLEN(arg1) >= MAXSTRING)
                     21:       runerr(210, &arg1);
                     22:    qtos(&arg1, sbuf);
                     23: 
                     24:    /*
                     25:     * Pass the C string made by qtos to the UNIX system() function and
                     26:     *  return the exit code of the command as the result of system().
                     27:     */
                     28:    mkint((long)((system(sbuf) >> 8) & 0377), &arg0);
                     29:    }
                     30: 
                     31: Procblock(system,1)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.