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

NAME
     xt_str_argv_cat() - Append argv-style list to a string

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

SYNOPSIS
     size_t  xt_str_argv_cat(char *string, char *argv[], size_t first_arg,
     size_t string_buff_size)

ARGUMENTS
     string		 String to which argv elements are appended
     argv		 Character pointer array to a list of elements
     first_arg		 Index of first argument to append
     string_buff_size	 Size of string array including null byte

DESCRIPTION
     Append  an  argv  style  list of arguments to a string.  This is useful for
     constructing a command to be passed to a  shell  via  system()  or  similar
     methods.

RETURN VALUES
     Length   of   string  +  all  argv  elements.   If  this  is  greater  than
     string_buff_size, then the string has been truncated.

EXAMPLES
     char    cmd[CMD_MAX + 1] = "ls",
	     *argv[] = { "-l", NULL };

     if ( xt_str_argv_cat(cmd, argv, 0, CMD_MAX + 1) > CMD_MAX + 1 )
	 fputs("string is truncated.n", stderr);
     else
	 system(cmd);

SEE ALSO
     strlcpy(3), strlcat(3), snprintf(3)

							      xt_str_argv_cat(3)

home | help