26#include "../tapctl/error.h"
27#include "../tapctl/tap.h"
47 seq->head = seq->head->
next;
59 size_t argument_size = (_tcslen(argument) + 1) *
sizeof(TCHAR);
63 msg(
M_FATAL,
"%s: malloc(%u) failed", __FUNCTION__,
sizeof(
struct msica_arg) + argument_size);
65 memcpy(p->
val, argument, argument_size);
68 if (seq->tail == NULL)
80 size_t argument_size = (_tcslen(argument) + 1) *
sizeof(TCHAR);
84 msg(
M_FATAL,
"%s: malloc(%u) failed", __FUNCTION__,
sizeof(
struct msica_arg) + argument_size);
86 memcpy(p->
val, argument, argument_size);
88 *(seq->tail ? &seq->tail->next : &seq->head) = p;
98 for (
struct msica_arg *p = seq->head; p != NULL; p = p->next)
100 size += _tcslen(p->val) + 1 ;
102 size *=
sizeof(TCHAR);
105 LPTSTR str = malloc(size);
108 msg(
M_FATAL,
"%s: malloc(%u) failed", __FUNCTION__, size);
114#pragma warning(disable: 4996)
118 _tcscpy(str, TEXT(
"x"));
122 for (
struct msica_arg *p = seq->head; p != NULL; p = p->next)
129 s += _tcslen(p->val);
void msica_arg_seq_free(_Inout_ struct msica_arg_seq *seq)
Frees argument sequence.
void msica_arg_seq_add_tail(_Inout_ struct msica_arg_seq *seq, _Inout_ LPCTSTR argument)
Appends argument to the end of the argument sequence.
void msica_arg_seq_init(_Inout_ struct msica_arg_seq *seq)
Initializes argument sequence.
void msica_arg_seq_add_head(_Inout_ struct msica_arg_seq *seq, _In_z_ LPCTSTR argument)
Inserts argument to the beginning of the argument sequence.
LPTSTR 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.
TCHAR val[]
Zero terminated argument string.