Merge pull request #5685 from akallabeth/multi_instance_arg_parse

COMMAND_LINE_ARGUMENT structs contain parser results, use one per instance
This commit is contained in:
Martin Fleisz 2019-11-06 09:09:22 +01:00 committed by GitHub
commit bc39b32d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 202 additions and 194 deletions

View File

@ -352,12 +352,6 @@ static UINT audin_alsa_close(IAudinDevice* device)
return error; return error;
} }
static COMMAND_LINE_ARGUMENT_A audin_alsa_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -370,6 +364,11 @@ static UINT audin_alsa_parse_addin_args(AudinALSADevice* device,
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
AudinALSADevice* alsa = (AudinALSADevice*) device; AudinALSADevice* alsa = (AudinALSADevice*) device;
COMMAND_LINE_ARGUMENT_A audin_alsa_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON |
COMMAND_LINE_IGN_UNKNOWN_KEYWORD; COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, status = CommandLineParseArgumentsA(args->argc, args->argv,

View File

@ -855,22 +855,21 @@ static UINT audin_set_device_name(AUDIN_PLUGIN* audin, const char* device_name)
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
static COMMAND_LINE_ARGUMENT_A audin_args[] =
{
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
{ "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
{ "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, ADDIN_ARGV* args) BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, ADDIN_ARGV* args)
{ {
int status; int status;
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
UINT error; UINT error;
COMMAND_LINE_ARGUMENT_A audin_args[] =
{
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
{ "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
{ "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
if (!args || args->argc == 1) if (!args || args->argc == 1)
return TRUE; return TRUE;

View File

@ -304,12 +304,6 @@ static UINT audin_mac_free(IAudinDevice* device)
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
static COMMAND_LINE_ARGUMENT_A audin_mac_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
static UINT audin_mac_parse_addin_args(AudinMacDevice* device, ADDIN_ARGV* args) static UINT audin_mac_parse_addin_args(AudinMacDevice* device, ADDIN_ARGV* args)
{ {
DWORD errCode; DWORD errCode;
@ -318,6 +312,12 @@ static UINT audin_mac_parse_addin_args(AudinMacDevice* device, ADDIN_ARGV* args)
char* str_num, *eptr; char* str_num, *eptr;
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A audin_mac_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
AudinMacDevice* mac = (AudinMacDevice*)device; AudinMacDevice* mac = (AudinMacDevice*)device;
if (args->argc == 1) if (args->argc == 1)

View File

@ -247,15 +247,6 @@ UINT audin_opensles_close(IAudinDevice* device)
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
static COMMAND_LINE_ARGUMENT_A audin_opensles_args[] =
{
{
"dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "audio device name"
},
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -268,6 +259,15 @@ static UINT audin_opensles_parse_addin_args(AudinOpenSLESDevice* device,
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*) device; AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*) device;
COMMAND_LINE_ARGUMENT_A audin_opensles_args[] =
{
{
"dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "audio device name"
},
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
WLog_Print(opensles->log, WLOG_DEBUG, "device=%p, args=%p", (void*) device, (void*) args); WLog_Print(opensles->log, WLOG_DEBUG, "device=%p, args=%p", (void*) device, (void*) args);
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, status = CommandLineParseArgumentsA(args->argc, args->argv,

View File

@ -381,12 +381,6 @@ static UINT audin_oss_free(IAudinDevice* device)
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
static COMMAND_LINE_ARGUMENT_A audin_oss_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -399,6 +393,13 @@ static UINT audin_oss_parse_addin_args(AudinOSSDevice* device, ADDIN_ARGV* args)
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
AudinOSSDevice* oss = (AudinOSSDevice*)device; AudinOSSDevice* oss = (AudinOSSDevice*)device;
COMMAND_LINE_ARGUMENT_A audin_oss_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON |
COMMAND_LINE_IGN_UNKNOWN_KEYWORD; COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, status = CommandLineParseArgumentsA(args->argc, args->argv,

View File

@ -425,12 +425,6 @@ static UINT audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
static COMMAND_LINE_ARGUMENT_A audin_pulse_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -442,6 +436,12 @@ static UINT audin_pulse_parse_addin_args(AudinPulseDevice* device, ADDIN_ARGV* a
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
AudinPulseDevice* pulse = (AudinPulseDevice*) device; AudinPulseDevice* pulse = (AudinPulseDevice*) device;
COMMAND_LINE_ARGUMENT_A audin_pulse_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, audin_pulse_args, flags, status = CommandLineParseArgumentsA(args->argc, args->argv, audin_pulse_args, flags,
pulse, NULL, NULL); pulse, NULL, NULL);

View File

@ -402,12 +402,6 @@ static UINT audin_winmm_open(IAudinDevice* device, AudinReceive receive, void* u
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
static COMMAND_LINE_ARGUMENT_A audin_winmm_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -419,6 +413,12 @@ static UINT audin_winmm_parse_addin_args(AudinWinmmDevice* device, ADDIN_ARGV* a
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
AudinWinmmDevice* winmm = (AudinWinmmDevice*) device; AudinWinmmDevice* winmm = (AudinWinmmDevice*) device;
COMMAND_LINE_ARGUMENT_A audin_winmm_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, audin_winmm_args, flags, status = CommandLineParseArgumentsA(args->argc, args->argv, audin_winmm_args, flags,
winmm, NULL, NULL); winmm, NULL, NULL);

View File

@ -462,12 +462,6 @@ static UINT rdpsnd_alsa_play(rdpsndDevicePlugin* device, const BYTE* data, size_
return latency + alsa->latency; return latency + alsa->latency;
} }
static COMMAND_LINE_ARGUMENT_A rdpsnd_alsa_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -479,6 +473,11 @@ static UINT rdpsnd_alsa_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV*
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*) device; rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*) device;
COMMAND_LINE_ARGUMENT_A rdpsnd_alsa_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, rdpsnd_alsa_args, flags, status = CommandLineParseArgumentsA(args->argc, args->argv, rdpsnd_alsa_args, flags,
alsa, NULL, NULL); alsa, NULL, NULL);

View File

@ -85,11 +85,6 @@ static void rdpsnd_fake_start(rdpsndDevicePlugin* device)
{ {
} }
static COMMAND_LINE_ARGUMENT_A rdpsnd_fake_args[] =
{
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -100,6 +95,10 @@ static UINT rdpsnd_fake_parse_addin_args(rdpsndFakePlugin* fake, ADDIN_ARGV* arg
int status; int status;
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A rdpsnd_fake_args[] =
{
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, status = CommandLineParseArgumentsA(args->argc, args->argv,
rdpsnd_fake_args, flags, fake, NULL, NULL); rdpsnd_fake_args, flags, fake, NULL, NULL);

View File

@ -296,15 +296,6 @@ static void rdpsnd_opensles_start(rdpsndDevicePlugin* device)
DEBUG_SND("opensles=%p", (void*) opensles); DEBUG_SND("opensles=%p", (void*) opensles);
} }
static COMMAND_LINE_ARGUMENT_A rdpsnd_opensles_args[] =
{
{
"dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "device"
},
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
static int rdpsnd_opensles_parse_addin_args(rdpsndDevicePlugin* device, static int rdpsnd_opensles_parse_addin_args(rdpsndDevicePlugin* device,
ADDIN_ARGV* args) ADDIN_ARGV* args)
{ {
@ -312,6 +303,15 @@ static int rdpsnd_opensles_parse_addin_args(rdpsndDevicePlugin* device,
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
rdpsndopenslesPlugin* opensles = (rdpsndopenslesPlugin*) device; rdpsndopenslesPlugin* opensles = (rdpsndopenslesPlugin*) device;
COMMAND_LINE_ARGUMENT_A rdpsnd_opensles_args[] =
{
{
"dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "device"
},
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
assert(opensles); assert(opensles);
assert(args); assert(args);
DEBUG_SND("opensles=%p, args=%p", (void*) opensles, (void*) args); DEBUG_SND("opensles=%p, args=%p", (void*) opensles, (void*) args);

View File

@ -388,12 +388,6 @@ static UINT rdpsnd_oss_play(rdpsndDevicePlugin* device, const BYTE* data, size_t
return 10; /* TODO: Get real latency in [ms] */ return 10; /* TODO: Get real latency in [ms] */
} }
static COMMAND_LINE_ARGUMENT_A rdpsnd_oss_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
static int rdpsnd_oss_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV* args) static int rdpsnd_oss_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV* args)
{ {
int status; int status;
@ -401,6 +395,11 @@ static int rdpsnd_oss_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV* a
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
rdpsndOssPlugin* oss = (rdpsndOssPlugin*)device; rdpsndOssPlugin* oss = (rdpsndOssPlugin*)device;
COMMAND_LINE_ARGUMENT_A rdpsnd_oss_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, rdpsnd_oss_args, flags, status = CommandLineParseArgumentsA(args->argc, args->argv, rdpsnd_oss_args, flags,
oss, NULL, NULL); oss, NULL, NULL);

View File

@ -519,12 +519,6 @@ static void rdpsnd_pulse_start(rdpsndDevicePlugin* device)
pa_threaded_mainloop_unlock(pulse->mainloop); pa_threaded_mainloop_unlock(pulse->mainloop);
} }
static COMMAND_LINE_ARGUMENT_A rdpsnd_pulse_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -536,6 +530,11 @@ static UINT rdpsnd_pulse_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*) device; rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*) device;
COMMAND_LINE_ARGUMENT_A rdpsnd_pulse_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, status = CommandLineParseArgumentsA(args->argc, args->argv,
rdpsnd_pulse_args, flags, pulse, NULL, NULL); rdpsnd_pulse_args, flags, pulse, NULL, NULL);

View File

@ -686,18 +686,6 @@ BOOL rdpsnd_set_device_name(rdpsndPlugin* rdpsnd, const char* device_name)
return (rdpsnd->device_name != NULL); return (rdpsnd->device_name != NULL);
} }
static COMMAND_LINE_ARGUMENT_A rdpsnd_args[] =
{
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
{ "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
{ "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
{ "latency", COMMAND_LINE_VALUE_REQUIRED, "<latency>", NULL, NULL, -1, NULL, "latency" },
{ "quality", COMMAND_LINE_VALUE_REQUIRED, "<quality mode>", NULL, NULL, -1, NULL, "quality mode" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -708,6 +696,17 @@ static UINT rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args)
int status; int status;
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A rdpsnd_args[] =
{
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
{ "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
{ "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
{ "latency", COMMAND_LINE_VALUE_REQUIRED, "<latency>", NULL, NULL, -1, NULL, "latency" },
{ "quality", COMMAND_LINE_VALUE_REQUIRED, "<quality mode>", NULL, NULL, -1, NULL, "quality mode" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
rdpsnd->wQualityMode = HIGH_QUALITY; /* default quality mode */ rdpsnd->wQualityMode = HIGH_QUALITY; /* default quality mode */
if (args->argc > 1) if (args->argc > 1)

View File

@ -489,14 +489,6 @@ static UINT tsmf_plugin_terminated(IWTSPlugin* pPlugin)
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
COMMAND_LINE_ARGUMENT_A tsmf_args[] =
{
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "audio subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ "decoder", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "decoder subsystem" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -508,6 +500,13 @@ static UINT tsmf_process_addin_args(IWTSPlugin* pPlugin, ADDIN_ARGV* args)
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
TSMF_PLUGIN* tsmf = (TSMF_PLUGIN*) pPlugin; TSMF_PLUGIN* tsmf = (TSMF_PLUGIN*) pPlugin;
COMMAND_LINE_ARGUMENT_A tsmf_args[] =
{
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "audio subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ "decoder", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "decoder subsystem" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, args->argv, status = CommandLineParseArgumentsA(args->argc, args->argv,
tsmf_args, flags, tsmf, NULL, NULL); tsmf_args, flags, tsmf, NULL, NULL);

View File

@ -450,16 +450,6 @@ static void udevman_load_interface(UDEVMAN* udevman)
udevman->iface.wait_urb = udevman_wait_urb; udevman->iface.wait_urb = udevman_wait_urb;
} }
COMMAND_LINE_ARGUMENT_A urbdrc_udevman_args[] =
{
{ "dbg", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "debug" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<devices>", NULL, NULL, -1, NULL, "device list" },
{ "id", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_VID_PID" },
{ "addr", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_ADDR" },
{ "auto", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_AUTO" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
static void urbdrc_udevman_register_devices(UDEVMAN* udevman, char* devices) static void urbdrc_udevman_register_devices(UDEVMAN* udevman, char* devices)
{ {
char* token; char* token;
@ -512,6 +502,15 @@ static void urbdrc_udevman_parse_addin_args(UDEVMAN* udevman, ADDIN_ARGV* args)
int status; int status;
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A urbdrc_udevman_args[] =
{
{ "dbg", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "debug" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<devices>", NULL, NULL, -1, NULL, "device list" },
{ "id", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_VID_PID" },
{ "addr", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_ADDR" },
{ "auto", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_AUTO" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, args->argv, status = CommandLineParseArgumentsA(args->argc, args->argv,
urbdrc_udevman_args, flags, udevman, NULL, NULL); urbdrc_udevman_args, flags, udevman, NULL, NULL);

View File

@ -1504,13 +1504,6 @@ BOOL urbdrc_set_subsystem(URBDRC_PLUGIN* urbdrc, char* subsystem)
return (urbdrc->subsystem != NULL); return (urbdrc->subsystem != NULL);
} }
COMMAND_LINE_ARGUMENT_A urbdrc_args[] =
{
{ "dbg", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "debug" },
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
/** /**
* Function description * Function description
* *
@ -1521,6 +1514,12 @@ static UINT urbdrc_process_addin_args(URBDRC_PLUGIN* urbdrc, ADDIN_ARGV* args)
int status; int status;
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A urbdrc_args[] =
{
{ "dbg", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "debug" },
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON; flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, args->argv, status = CommandLineParseArgumentsA(args->argc, args->argv,
urbdrc_args, flags, urbdrc, NULL, NULL); urbdrc_args, flags, urbdrc, NULL, NULL);

View File

@ -353,9 +353,11 @@ BOOL freerdp_client_print_command_line_help(int argc, char** argv)
} }
BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv, BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
COMMAND_LINE_ARGUMENT_A* custom) COMMAND_LINE_ARGUMENT_A* custom)
{ {
const char* name = "FreeRDP"; const char* name = "FreeRDP";
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(args)];
memcpy(largs, args, sizeof(args));
if (argc > 0) if (argc > 0)
name = argv[0]; name = argv[0];
@ -372,7 +374,7 @@ BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
printf(" +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')\n"); printf(" +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')\n");
printf("\n"); printf("\n");
freerdp_client_print_command_line_args(custom); freerdp_client_print_command_line_args(custom);
freerdp_client_print_command_line_args(args); freerdp_client_print_command_line_args(largs);
printf("\n"); printf("\n");
printf("Examples:\n"); printf("Examples:\n");
printf(" %s connection.rdp /p:Pwd123! /f\n", name); printf(" %s connection.rdp /p:Pwd123! /f\n", name);
@ -1304,6 +1306,9 @@ static int freerdp_detect_windows_style_command_line_syntax(int argc, char** arg
DWORD flags; DWORD flags;
int detect_status; int detect_status;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(args)];
memcpy(largs, args, sizeof(args));
flags = COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_SILENCE_PARSER; flags = COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_SILENCE_PARSER;
flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS; flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
@ -1314,14 +1319,14 @@ static int freerdp_detect_windows_style_command_line_syntax(int argc, char** arg
*count = 0; *count = 0;
detect_status = 0; detect_status = 0;
CommandLineClearArgumentsA(args); CommandLineClearArgumentsA(largs);
status = CommandLineParseArgumentsA(argc, argv, args, flags, status = CommandLineParseArgumentsA(argc, argv, largs, flags,
NULL, freerdp_detect_command_line_pre_filter, NULL); NULL, freerdp_detect_command_line_pre_filter, NULL);
if (status < 0) if (status < 0)
return status; return status;
arg = args; arg = largs;
do do
{ {
@ -1345,6 +1350,9 @@ int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv,
DWORD flags; DWORD flags;
int detect_status; int detect_status;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(args)];
memcpy(largs, args, sizeof(args));
flags = COMMAND_LINE_SEPARATOR_SPACE | COMMAND_LINE_SILENCE_PARSER; flags = COMMAND_LINE_SEPARATOR_SPACE | COMMAND_LINE_SILENCE_PARSER;
flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH; flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE; flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
@ -1356,14 +1364,14 @@ int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv,
*count = 0; *count = 0;
detect_status = 0; detect_status = 0;
CommandLineClearArgumentsA(args); CommandLineClearArgumentsA(largs);
status = CommandLineParseArgumentsA(argc, argv, args, flags, status = CommandLineParseArgumentsA(argc, argv, largs, flags,
NULL, freerdp_detect_command_line_pre_filter, NULL); NULL, freerdp_detect_command_line_pre_filter, NULL);
if (status < 0) if (status < 0)
return status; return status;
arg = args; arg = largs;
do do
{ {
@ -1439,9 +1447,11 @@ int freerdp_client_settings_command_line_status_print(rdpSettings* settings,
} }
int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings,
int status, int argc, char** argv, COMMAND_LINE_ARGUMENT_A* custom) int status, int argc, char** argv, COMMAND_LINE_ARGUMENT_A* custom)
{ {
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(args)];
memcpy(largs, args, sizeof(args));
if (status == COMMAND_LINE_STATUS_PRINT_VERSION) if (status == COMMAND_LINE_STATUS_PRINT_VERSION)
{ {
@ -1457,7 +1467,7 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings,
} }
else if (status == COMMAND_LINE_STATUS_PRINT) else if (status == COMMAND_LINE_STATUS_PRINT)
{ {
arg = CommandLineFindArgumentA(args, "kbd-list"); arg = CommandLineFindArgumentA(largs, "kbd-list");
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT) if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
{ {
@ -1490,7 +1500,7 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings,
printf("\n"); printf("\n");
} }
arg = CommandLineFindArgumentA(args, "monitor-list"); arg = CommandLineFindArgumentA(largs, "monitor-list");
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT) if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
{ {
@ -1582,6 +1592,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
BOOL promptForPassword = FALSE; BOOL promptForPassword = FALSE;
BOOL compatibility = FALSE; BOOL compatibility = FALSE;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(args)];
memcpy(largs, args, sizeof(args));
/* Command line detection fails if only a .rdp or .msrcIncident file /* Command line detection fails if only a .rdp or .msrcIncident file
* is supplied. Check this case first, only then try to detect * is supplied. Check this case first, only then try to detect
@ -1624,8 +1636,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
} }
CommandLineClearArgumentsA(args); CommandLineClearArgumentsA(largs);
status = CommandLineParseArgumentsA(argc, argv, args, flags, status = CommandLineParseArgumentsA(argc, argv, largs, flags,
settings, settings,
freerdp_client_command_line_pre_filter, freerdp_client_command_line_pre_filter,
freerdp_client_command_line_post_filter); freerdp_client_command_line_post_filter);
@ -1634,8 +1646,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
return status; return status;
} }
CommandLineFindArgumentA(args, "v"); CommandLineFindArgumentA(largs, "v");
arg = args; arg = largs;
errno = 0; errno = 0;
do do
@ -3158,7 +3170,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
settings->ColorDepth = 32; settings->ColorDepth = 32;
} }
arg = CommandLineFindArgumentA(args, "port"); arg = CommandLineFindArgumentA(largs, "port");
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT) if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
{ {
@ -3170,14 +3182,14 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
settings->ServerPort = (UINT32)val; settings->ServerPort = (UINT32)val;
} }
arg = CommandLineFindArgumentA(args, "p"); arg = CommandLineFindArgumentA(largs, "p");
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT) if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
{ {
FillMemory(arg->Value, strlen(arg->Value), '*'); FillMemory(arg->Value, strlen(arg->Value), '*');
} }
arg = CommandLineFindArgumentA(args, "gp"); arg = CommandLineFindArgumentA(largs, "gp");
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT) if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
{ {

View File

@ -22,7 +22,8 @@
#include <winpr/cmdline.h> #include <winpr/cmdline.h>
static COMMAND_LINE_ARGUMENT_A args[] = { static const COMMAND_LINE_ARGUMENT_A args[] =
{
{ "a", COMMAND_LINE_VALUE_REQUIRED, "<addin>[,<options>]", NULL, NULL, -1, "addin", "Addin" }, { "a", COMMAND_LINE_VALUE_REQUIRED, "<addin>[,<options>]", NULL, NULL, -1, "addin", "Addin" },
{ "action-script", COMMAND_LINE_VALUE_REQUIRED, "<file-name>", "~/.config/freerdp/action.sh", { "action-script", COMMAND_LINE_VALUE_REQUIRED, "<file-name>", "~/.config/freerdp/action.sh",
NULL, -1, NULL, "Action script" }, NULL, -1, NULL, "Action script" },
@ -327,12 +328,9 @@ static COMMAND_LINE_ARGUMENT_A args[] = {
"Hyper-V console (use port 2179, disable negotiation)" }, "Hyper-V console (use port 2179, disable negotiation)" },
{ "w", COMMAND_LINE_VALUE_REQUIRED, "<width>", "1024", NULL, -1, NULL, "Width" }, { "w", COMMAND_LINE_VALUE_REQUIRED, "<width>", "1024", NULL, -1, NULL, "Width" },
{ "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "wallpaper" }, { "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "wallpaper" },
{ "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, { "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "full window drag" },
"full window drag" }, { "window-position", COMMAND_LINE_VALUE_REQUIRED, "<xpos>x<ypos>", NULL, NULL, -1, NULL, "window position" },
{ "window-position", COMMAND_LINE_VALUE_REQUIRED, "<xpos>x<ypos>", NULL, NULL, -1, NULL, { "wm-class", COMMAND_LINE_VALUE_REQUIRED, "<class-name>", NULL, NULL, -1, NULL, "Set the WM_CLASS hint for the window instance" },
"window position" },
{ "wm-class", COMMAND_LINE_VALUE_REQUIRED, "<class-name>", NULL, NULL, -1, NULL,
"Set the WM_CLASS hint for the window instance" },
{ "workarea", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Use available work area" }, { "workarea", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Use available work area" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL } { NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
}; };

View File

@ -41,7 +41,7 @@
#define TAG CLIENT_TAG("common.compatibility") #define TAG CLIENT_TAG("common.compatibility")
static COMMAND_LINE_ARGUMENT_A old_args[] = static const COMMAND_LINE_ARGUMENT_A old_args[] =
{ {
{ "0", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "connect to console session" }, { "0", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "connect to console session" },
{ "a", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "set color depth in bits, default is 16" }, { "a", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "set color depth in bits, default is 16" },
@ -414,6 +414,9 @@ int freerdp_detect_old_command_line_syntax(int argc, char** argv, size_t* count)
int detect_status; int detect_status;
rdpSettings* settings; rdpSettings* settings;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(old_args)];
memcpy(largs, old_args, sizeof(old_args));
*count = 0; *count = 0;
detect_status = 0; detect_status = 0;
flags = COMMAND_LINE_SEPARATOR_SPACE | COMMAND_LINE_SILENCE_PARSER; flags = COMMAND_LINE_SEPARATOR_SPACE | COMMAND_LINE_SILENCE_PARSER;
@ -424,8 +427,8 @@ int freerdp_detect_old_command_line_syntax(int argc, char** argv, size_t* count)
if (!settings) if (!settings)
return -1; return -1;
CommandLineClearArgumentsA(old_args); CommandLineClearArgumentsA(largs);
status = CommandLineParseArgumentsA(argc, argv, old_args, flags, settings, status = CommandLineParseArgumentsA(argc, argv, largs, flags, settings,
freerdp_client_old_command_line_pre_filter, NULL); freerdp_client_old_command_line_pre_filter, NULL);
if (status < 0) if (status < 0)
@ -434,7 +437,7 @@ int freerdp_detect_old_command_line_syntax(int argc, char** argv, size_t* count)
return status; return status;
} }
arg = old_args; arg = largs;
do do
{ {
@ -479,12 +482,15 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe
int status; int status;
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(old_args)];
memcpy(largs, old_args, sizeof(old_args));
freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0); freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0);
flags = COMMAND_LINE_SEPARATOR_SPACE; flags = COMMAND_LINE_SEPARATOR_SPACE;
flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH; flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE; flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
flags |= COMMAND_LINE_SIGIL_NOT_ESCAPED; flags |= COMMAND_LINE_SIGIL_NOT_ESCAPED;
status = CommandLineParseArgumentsA(argc, argv, old_args, flags, settings, status = CommandLineParseArgumentsA(argc, argv, largs, flags, settings,
freerdp_client_old_command_line_pre_filter, freerdp_client_old_command_line_post_filter); freerdp_client_old_command_line_pre_filter, freerdp_client_old_command_line_post_filter);
if (status == COMMAND_LINE_STATUS_PRINT_VERSION) if (status == COMMAND_LINE_STATUS_PRINT_VERSION)
@ -506,7 +512,7 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe
return COMMAND_LINE_STATUS_PRINT_HELP; return COMMAND_LINE_STATUS_PRINT_HELP;
} }
arg = old_args; arg = largs;
errno = 0; errno = 0;
settings->BitmapCacheEnabled = TRUE; settings->BitmapCacheEnabled = TRUE;
settings->OffscreenSupportLevel = TRUE; settings->OffscreenSupportLevel = TRUE;

View File

@ -45,7 +45,7 @@
#define TAG SERVER_TAG("shadow") #define TAG SERVER_TAG("shadow")
static COMMAND_LINE_ARGUMENT_A shadow_args[] = static const COMMAND_LINE_ARGUMENT_A shadow_args[] =
{ {
{ "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Server port" }, { "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Server port" },
{ "ipc-socket", COMMAND_LINE_VALUE_REQUIRED, "<ipc-socket>", NULL, NULL, -1, NULL, "Server IPC socket" }, { "ipc-socket", COMMAND_LINE_VALUE_REQUIRED, "<ipc-socket>", NULL, NULL, -1, NULL, "Server IPC socket" },
@ -71,7 +71,8 @@ static int shadow_server_print_command_line_help(int argc, char** argv)
char* str; char* str;
size_t length; size_t length;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(shadow_args)];
memcpy(largs, shadow_args, sizeof(shadow_args));
if (argc < 1) if (argc < 1)
return -1; return -1;
@ -82,7 +83,7 @@ static int shadow_server_print_command_line_help(int argc, char** argv)
WLog_INFO(TAG, " /option:<value> (specifies option with value)"); WLog_INFO(TAG, " /option:<value> (specifies option with value)");
WLog_INFO(TAG, " +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')"); WLog_INFO(TAG, " +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')");
WLog_INFO(TAG, ""); WLog_INFO(TAG, "");
arg = shadow_args; arg = largs;
do do
{ {
@ -172,20 +173,22 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
DWORD flags; DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
rdpSettings* settings = server->settings; rdpSettings* settings = server->settings;
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(shadow_args)];
memcpy(largs, shadow_args, sizeof(shadow_args));
if (argc < 2) if (argc < 2)
return 1; return 1;
CommandLineClearArgumentsA(shadow_args); CommandLineClearArgumentsA(largs);
flags = COMMAND_LINE_SEPARATOR_COLON; flags = COMMAND_LINE_SEPARATOR_COLON;
flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS; flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
status = CommandLineParseArgumentsA(argc, argv, shadow_args, flags, server, NULL, status = CommandLineParseArgumentsA(argc, argv, largs, flags, server, NULL,
NULL); NULL);
if (status < 0) if (status < 0)
return status; return status;
arg = shadow_args; arg = largs;
errno = 0; errno = 0;
do do
@ -358,7 +361,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
} }
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL); while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
arg = CommandLineFindArgumentA(shadow_args, "monitors"); arg = CommandLineFindArgumentA(largs, "monitors");
if (arg && (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)) if (arg && (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
{ {

View File

@ -19,44 +19,6 @@ static const char* testArgv[] =
0 0
}; };
static COMMAND_LINE_ARGUMENT_A args[] =
{
{ "v", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "destination server" },
{ "port", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "server port" },
{ "w", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "width" },
{ "h", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "height" },
{ "f", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "fullscreen" },
{ "bpp", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "session bpp (color depth)" },
{ "admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "console", "admin (or console) session" },
{ "multimon", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "multi-monitor" },
{ "a", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, "addin", "addin" },
{ "u", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "username" },
{ "p", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "password" },
{ "d", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "domain" },
{ "z", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "compression" },
{ "audio", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "audio output mode" },
{ "mic", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "audio input (microphone)" },
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "smooth fonts (cleartype)" },
{ "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "desktop composition" },
{ "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "full window drag" },
{ "menu-anims", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "menu animations" },
{ "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "themes" },
{ "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "wallpaper" },
{ "codec", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "codec" },
{ "nego", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "protocol security negotiation" },
{ "sec", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "force specific protocol security" },
{ "sec-rdp", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "rdp protocol security" },
{ "sec-tls", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "tls protocol security" },
{ "sec-nla", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "nla protocol security" },
{ "sec-ext", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "nla extended protocol security" },
{ "cert-name", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "certificate name" },
{ "cert-ignore", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "ignore certificate" },
{ "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1, NULL, "print version" },
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "print help" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
int TestCmdLine(int argc, char* argv[]) int TestCmdLine(int argc, char* argv[])
{ {
int status; int status;
@ -67,6 +29,42 @@ int TestCmdLine(int argc, char* argv[])
COMMAND_LINE_ARGUMENT_A* arg; COMMAND_LINE_ARGUMENT_A* arg;
int testArgc; int testArgc;
char** command_line; char** command_line;
COMMAND_LINE_ARGUMENT_A args[] =
{
{ "v", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "destination server" },
{ "port", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "server port" },
{ "w", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "width" },
{ "h", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "height" },
{ "f", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "fullscreen" },
{ "bpp", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "session bpp (color depth)" },
{ "admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "console", "admin (or console) session" },
{ "multimon", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "multi-monitor" },
{ "a", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, "addin", "addin" },
{ "u", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "username" },
{ "p", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "password" },
{ "d", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "domain" },
{ "z", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "compression" },
{ "audio", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "audio output mode" },
{ "mic", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "audio input (microphone)" },
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "smooth fonts (cleartype)" },
{ "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "desktop composition" },
{ "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "full window drag" },
{ "menu-anims", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "menu animations" },
{ "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "themes" },
{ "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "wallpaper" },
{ "codec", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "codec" },
{ "nego", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "protocol security negotiation" },
{ "sec", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "force specific protocol security" },
{ "sec-rdp", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "rdp protocol security" },
{ "sec-tls", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "tls protocol security" },
{ "sec-nla", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "nla protocol security" },
{ "sec-ext", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "nla extended protocol security" },
{ "cert-name", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "certificate name" },
{ "cert-ignore", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "ignore certificate" },
{ "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1, NULL, "print version" },
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "print help" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
flags = COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_SIGIL_PLUS_MINUS; flags = COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_SIGIL_PLUS_MINUS;
testArgc = string_list_length(testArgv); testArgc = string_list_length(testArgv);