File:  [CSRG BSD Unix] / 43BSD / contrib / icon / functions / system.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
BSD 4.3

#include "../h/rt.h"

/*
 * system(s) - execute string s as a system command.
 */

Xsystem(nargs, arg1, arg0)
int nargs;
struct descrip arg1, arg0;
   {
   char sbuf[MAXSTRING];

   DeRef(arg1)

   /*
    * s must be string and smaller than MAXSTRING characters long.
    */
   if (!QUAL(arg1) || STRLEN(arg1) < 0)
      runerr(103, &arg1);
   if (STRLEN(arg1) >= MAXSTRING)
      runerr(210, &arg1);
   qtos(&arg1, sbuf);

   /*
    * Pass the C string made by qtos to the UNIX system() function and
    *  return the exit code of the command as the result of system().
    */
   mkint((long)((system(sbuf) >> 8) & 0377), &arg0);
   }

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.