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

FreeBSD Manual Pages

  
 
  

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

NAME
     xt_parse_cmd() - Convert a command string to an argv-style array

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

SYNOPSIS
     char    *xt_parse_cmd(char *argv[], int max_args, const char *cmd)

ARGUMENTS
     argv:   Pointer array to be filled with command tokens
     cmd:    Raw command string with limited meta-character support
     from xt_strshellcpy(3)

DESCRIPTION
     Breaks a shell command into an argv[] style array suitable for xt_spawnvp()
     or  execv*().   A	copy of cmd is created using xt_strshellcpy(), which ex-
     pands certain shell features such as variables and paths starting with '~'.
     The copy is then modified by replacing separators with '0' and  the  argv[]
     array is populated with pointers to each token in the copy.

RETURN VALUES
     Pointer  to strdup() copy of cmd, which should be freed as soon as possible
     when argv[] is no longer needed.

EXAMPLES
     char *cmd, *argv[], *expanded_cmd;

     expanded_cmd = xt_parse_cmd(argv, cmd);
     xt_spawnvp(P_WAIT, P_NOECHO, argv, NULL, NULL, NULL);
     free(expanded_cmd);

SEE ALSO
     xt_spawnvp(3), xt_spawnlp(3), exec(3)

								 xt_parse_cmd(3)

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

home | help