Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
xt_spawnlp(3)		    Library Functions Manual		   xt_spawnlp(3)

NAME
     xt_spawnlp() - Fork and exec a process from a variable argument list

LIBRARY
     #include <xtend/proc.h>
     -lxtend

SYNOPSIS
     int     xt_spawnlp(int parent_action, int echo,
     char *infile, char *outfile, char *errfile,
     char *arg0, ...)

ARGUMENTS
     parent_action:  P_WAIT or P_NOWAIT
     echo:	     P_ECHO or P_NOECHO
     infile:	     File to which stdin of child is redirected or NULL
     outfile:	     File to which stdout of child is redirected or NULL
     errfile:	     File to which stderr of child is redirected or NULL
     arg0:	     The name of the program to run
     arg1, ...	     Command-line arguments
     IMPORTANT:      The last argument must be NULL

DESCRIPTION
     xt_spawnvp() and xt_spawnlp() are wrappers around fork(2) and exec(3) which
     make  it  easy to run a child process without an intermediate shell process
     as is used by system(3).  The xt_spawnlp() function spawns a child  process
     using  a  variable argument list.	The 6th argument is passed to argv[0] of
     the child, the 7th to argv[1], etc.

     The xt_spawnvp() function spawns a process using the command  contained  in
     an argv[] array constructed by the caller.  xt_spawnlp() automatically con-
     structs such an argv[] array and calls xt_spawnvp().

     The  calling process waits for the child to complete if P_WAIT is passed to
     parent_action, or continues immediately if P_NOWAIT is passed.   If  P_ECHO
     is  passed  as  the  echo	argument,  the command is echoed, the command is
     echoed to the parent's stdout.

     If infile, outfile, or errfile are not NULL, then	the  corresponding  file
     streams stdin, stdout, or stderr are redirected to the filename provided.

RETURN VALUES
     The  exit	status	of  the child process if P_WAIT is passed The PID of the
     child process if P_NOWAIT is passed

SEE ALSO
     xt_spawnvp(3), fork(2), exec(3)

								   xt_spawnlp(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xt_spawnlp&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help