mirror of https://gitee.com/openkylin/libvirt.git
add function virCommandNewVAList
Add function virCommandNewVAList which is equivalent to the virCommandNewArgList but with va_list instead of a variable number of arguments. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
This commit is contained in:
parent
cafc26ff5f
commit
4033df7ed8
|
@ -815,6 +815,28 @@ virCommandNewArgList(const char *binary, ...)
|
|||
return cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* virCommandNewVAList:
|
||||
* @binary: program to run
|
||||
* @va_list: additional arguments
|
||||
*
|
||||
* Create a new command with a NULL terminated
|
||||
* variable argument list. @binary is handled as in virCommandNew.
|
||||
*/
|
||||
virCommandPtr
|
||||
virCommandNewVAList(const char *binary, va_list list)
|
||||
{
|
||||
virCommandPtr cmd = virCommandNew(binary);
|
||||
const char *arg;
|
||||
|
||||
if (!cmd || cmd->has_error)
|
||||
return cmd;
|
||||
|
||||
while ((arg = va_arg(list, const char *)) != NULL)
|
||||
virCommandAddArg(cmd, arg);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Preserve the specified file descriptor in the child, instead of
|
||||
|
|
|
@ -45,6 +45,9 @@ virCommandPtr virCommandNewArgs(const char *const*args) ATTRIBUTE_NONNULL(1);
|
|||
virCommandPtr virCommandNewArgList(const char *binary, ...)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
|
||||
|
||||
virCommandPtr virCommandNewVAList(const char *binary, va_list list)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/* All error report from these setup APIs is
|
||||
* delayed until the Run/RunAsync methods
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue