mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
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;
|
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
|
* 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, ...)
|
virCommandPtr virCommandNewArgList(const char *binary, ...)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
|
||||||
|
|
||||||
|
virCommandPtr virCommandNewVAList(const char *binary, va_list list)
|
||||||
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
/* All error report from these setup APIs is
|
/* All error report from these setup APIs is
|
||||||
* delayed until the Run/RunAsync methods
|
* delayed until the Run/RunAsync methods
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user