25#include "../tapctl/error.h"
26#include "../tapctl/tap.h"
46 seq->head = seq->head->
next;
56 size_t argument_size = (wcslen(argument) + 1) *
sizeof(WCHAR);
60 msg(
M_FATAL,
"%s: malloc(%u) failed", __FUNCTION__,
61 sizeof(
struct msica_arg) + argument_size);
63 memcpy(p->
val, argument, argument_size);
66 if (seq->tail == NULL)
76 size_t argument_size = (wcslen(argument) + 1) *
sizeof(WCHAR);
80 msg(
M_FATAL,
"%s: malloc(%u) failed", __FUNCTION__,
81 sizeof(
struct msica_arg) + argument_size);
83 memcpy(p->
val, argument, argument_size);
85 *(seq->tail ? &seq->tail->next : &seq->head) = p;
95 for (
struct msica_arg *p = seq->head; p != NULL; p = p->next)
97 size += wcslen(p->val) + 1 ;
99 size *=
sizeof(WCHAR);
102 LPWSTR str = malloc(size);
105 msg(
M_FATAL,
"%s: malloc(%u) failed", __FUNCTION__, size);
122 for (
struct msica_arg *p = seq->head; p != NULL; p = p->next)
void msica_arg_seq_free(_Inout_ struct msica_arg_seq *seq)
Frees argument sequence.
void msica_arg_seq_init(_Inout_ struct msica_arg_seq *seq)
Initializes argument sequence.
void msica_arg_seq_add_tail(_Inout_ struct msica_arg_seq *seq, _Inout_ LPCWSTR argument)
Appends argument to the end of the argument sequence.
void msica_arg_seq_add_head(_Inout_ struct msica_arg_seq *seq, _In_z_ LPCWSTR argument)
Inserts argument to the beginning of the argument sequence.
LPWSTR msica_arg_seq_join(_In_ const struct msica_arg_seq *seq)
Join arguments of the argument sequence into a space delimited string.
struct msica_arg * next
Pointer to the next argument in the sequence.
WCHAR val[]
Zero terminated argument string.