home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / system.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  1.9 KB  |  67 lines

  1.  
  2.  
  3.  
  4. SYSTEM(3)           MINTLIB LIBRARY FUNCTIONS           SYSTEM(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        system - execute a command, passed a string
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        #include <unistd.h>
  12.  
  13.        int system(const char *cmd);
  14.  
  15. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  16.        system executes the command in the string, and waits until
  17.        it terminates.
  18.  
  19.        The first word in the string is the name of the program to
  20.        be  executed;  this  program  is  searched  in the current
  21.        directory and on the directories set  in  the  environment
  22.        variable  PATH.  The  normal extensions ".ttp", ".tos" and
  23.        ".prg" are tried when the program is being searched.
  24.  
  25.        If the rest of the string contains  unquoted  '<'  or  '>'
  26.        characters, standard input or standard output for the com-
  27.        mand to be run is redirected to the file with the filename
  28.        following the '<' or '>'.
  29.  
  30.        The  remaining part of the string is passed to the program
  31.        as a command line.
  32.  
  33.        This routine is implemented using spawnvp.
  34.  
  35. R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
  36.        system(NULL) returns 1 as an  indication  system  is  sup-
  37.        ported.
  38.  
  39.        When a valid command line is passed, system returns:
  40.        -1  when out of memory.
  41.         2   when  the  redirection of stdin or stdout fails.  The
  42.        return value of the program called when successful.
  43.  
  44. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  45.        s✓sp✓pa✓aw✓wn✓nv✓vp✓p(✓(3✓3)✓),✓, e✓ex✓xe✓ec✓cv✓ve✓e(✓(3✓3)✓),✓, p✓po✓op✓pe✓en✓n(✓(3✓3)✓)
  46.  
  47. N✓NO✓OT✓TE✓E
  48.        On UN*X systems, this starts up the  shell  /bin/sh  as  a
  49.        child  process.  The  shell executes the command passed to
  50.        system.  Thus, on UN*X systems, one can pass a  more  com-
  51.        plicated command line to system, for instance one contain-
  52.        ing pipes or shell scripts. This may cause  some  problems
  53.        when porting UN*X programs to the Atari.
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.