2011-07-22 08:53:54 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol client.
|
|
|
|
* Arguments Parsing
|
|
|
|
*
|
|
|
|
* Copyright 2009-2011 Jay Sorg
|
|
|
|
* Copyright 2011 Vic Lee
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2012-08-15 01:50:10 +04:00
|
|
|
#include <unistd.h>
|
2011-08-16 01:05:48 +04:00
|
|
|
#include <freerdp/settings.h>
|
2011-08-16 23:00:25 +04:00
|
|
|
#include <freerdp/utils/print.h>
|
2011-07-22 08:53:54 +04:00
|
|
|
#include <freerdp/utils/memory.h>
|
|
|
|
#include <freerdp/utils/args.h>
|
2012-07-25 14:39:54 +04:00
|
|
|
#include <freerdp/utils/passphrase.h>
|
2011-07-22 08:53:54 +04:00
|
|
|
|
2012-06-06 13:53:30 +04:00
|
|
|
|
|
|
|
void freerdp_parse_hostname(rdpSettings* settings, char* hostname) {
|
|
|
|
char* p;
|
|
|
|
if (hostname[0] == '[' && (p = strchr(hostname, ']'))
|
|
|
|
&& (p[1] == 0 || (p[1] == ':' && !strchr(p + 2, ':')))) {
|
|
|
|
/* Either "[...]" or "[...]:..." with at most one : after the brackets */
|
|
|
|
settings->hostname = xstrdup(hostname + 1);
|
|
|
|
if ((p = strchr((char*)settings->hostname, ']'))) {
|
|
|
|
*p = 0;
|
|
|
|
if (p[1] == ':')
|
|
|
|
settings->port = atoi(p + 2);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Port number is cut off and used if exactly one : in the string */
|
|
|
|
settings->hostname = xstrdup(hostname);
|
|
|
|
if ((p = strchr((char*)settings->hostname, ':')) && !strchr(p + 1, ':')) {
|
|
|
|
*p = 0;
|
|
|
|
settings->port = atoi(p + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-22 08:53:54 +04:00
|
|
|
/**
|
|
|
|
* Parse command-line arguments and update rdpSettings members accordingly.
|
|
|
|
* @param settings pointer to rdpSettings struct to be updated.
|
|
|
|
* @param argc number of arguments available.
|
|
|
|
* @param argv string array of the arguments.
|
|
|
|
* @param plugin_callback function to be called when a plugin needs to be loaded.
|
|
|
|
* @param plugin_user_data pointer to be passed to the plugin_callback function.
|
|
|
|
* @param ui_callback function to be called when a UI-specific argument is being processed.
|
|
|
|
* @param ui_user_data pointer to be passed to the ui_callback function.
|
2012-01-15 01:30:48 +04:00
|
|
|
* @return number of arguments that were parsed, or FREERDP_ARGS_PARSE_RESULT on failure or --version/--help
|
2011-07-22 08:53:54 +04:00
|
|
|
*/
|
|
|
|
int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
|
|
|
|
ProcessPluginArgs plugin_callback, void* plugin_user_data,
|
|
|
|
ProcessUIArgs ui_callback, void* ui_user_data)
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
char* p;
|
2011-07-28 19:09:51 +04:00
|
|
|
int i, j;
|
|
|
|
int index = 1;
|
|
|
|
int num_extensions = 0;
|
2011-08-18 01:28:26 +04:00
|
|
|
RDP_PLUGIN_DATA* plugin_data;
|
2011-07-22 08:53:54 +04:00
|
|
|
|
|
|
|
while (index < argc)
|
|
|
|
{
|
2011-08-27 11:13:14 +04:00
|
|
|
if ((strcmp("-h", argv[index]) == 0 ) || (strcmp("--help", argv[index]) == 0 ))
|
|
|
|
{
|
|
|
|
printf("\n"
|
|
|
|
"FreeRDP - A Free Remote Desktop Protocol Client\n"
|
|
|
|
"See http://www.freerdp.com for more information\n"
|
|
|
|
"\n"
|
|
|
|
"Usage: %s [options] server:port\n"
|
|
|
|
" -0: connect to console session\n"
|
2012-11-13 00:03:39 +04:00
|
|
|
" -a: set color depth in bits, default is 16\n"
|
|
|
|
" -c: shell working directory\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" -D: hide window decorations\n"
|
2011-12-02 18:58:38 +04:00
|
|
|
" -T: window title\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" -d: domain\n"
|
|
|
|
" -f: fullscreen mode\n"
|
|
|
|
" -g: set geometry, using format WxH or X%% or 'workarea', default is 1024x768\n"
|
|
|
|
" -h: print this help\n"
|
|
|
|
" -k: set keyboard layout ID\n"
|
2012-12-03 19:41:42 +04:00
|
|
|
" -K: do not interfere with window manager bindings (don't grab keyboard)\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" -n: hostname\n"
|
|
|
|
" -o: console audio\n"
|
|
|
|
" -p: password\n"
|
|
|
|
" -s: set startup-shell\n"
|
|
|
|
" -t: alternative port number, default is 3389\n"
|
|
|
|
" -u: username\n"
|
2012-12-02 03:40:09 +04:00
|
|
|
" -x: performance flags (m[odem], b[roadband] l[an], or a bit-mask)\n"
|
2011-12-09 22:53:19 +04:00
|
|
|
" -X: embed into another window with a given XID.\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" -z: enable compression\n"
|
|
|
|
" --app: RemoteApp connection. This implies -g workarea\n"
|
|
|
|
" --ext: load an extension\n"
|
|
|
|
" --no-auth: disable authentication\n"
|
2012-06-06 13:53:30 +04:00
|
|
|
" --authonly: authentication only, no UI\n"
|
|
|
|
" --from-stdin: unspecified username, password, domain and hostname params are prompted\n"
|
2012-12-02 03:40:09 +04:00
|
|
|
" --help: print this help\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" --no-fastpath: disable fast-path\n"
|
2011-12-17 01:09:21 +04:00
|
|
|
" --gdi: graphics rendering (hw, sw)\n"
|
2012-12-02 03:40:09 +04:00
|
|
|
" --no-motion: don't send mouse motion events\n"
|
2011-10-10 05:23:18 +04:00
|
|
|
" --no-osb: disable offscreen bitmaps\n"
|
|
|
|
" --no-bmp-cache: disable bitmap cache\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" --plugin: load a virtual channel plugin\n"
|
|
|
|
" --rfx: enable RemoteFX\n"
|
2011-11-25 16:09:16 +04:00
|
|
|
" --rfx-mode: RemoteFX operational flags (v[ideo], i[mage]), default is video\n"
|
2011-12-01 20:56:12 +04:00
|
|
|
" --nsc: enable NSCodec (experimental)\n"
|
2011-12-16 21:04:09 +04:00
|
|
|
" --disable-wallpaper: disables wallpaper\n"
|
2011-12-13 04:20:52 +04:00
|
|
|
" --composition: enable desktop composition\n"
|
2011-12-16 21:04:09 +04:00
|
|
|
" --disable-full-window-drag: disables full window drag\n"
|
|
|
|
" --disable-menu-animations: disables menu animations\n"
|
|
|
|
" --disable-theming: disables theming\n"
|
2012-12-02 03:40:09 +04:00
|
|
|
" --kbd-list: list all keyboard layout ids used by -k\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" --no-rdp: disable Standard RDP encryption\n"
|
|
|
|
" --no-tls: disable TLS encryption\n"
|
|
|
|
" --no-nla: disable network level authentication\n"
|
2011-12-12 01:53:24 +04:00
|
|
|
" --ntlm: force NTLM authentication protocol version (1 or 2)\n"
|
2012-12-02 03:40:09 +04:00
|
|
|
" --certificate-name: use the argument as the logon certificate, instead of the server name\n"
|
2011-10-19 11:42:53 +04:00
|
|
|
" --ignore-certificate: ignore verification of logon certificate\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" --sec: force protocol security (rdp, tls or nla)\n"
|
2012-01-25 19:06:31 +04:00
|
|
|
" --secure-checksum: use salted checksums with Standard RDP encryption\n"
|
2011-08-27 11:13:14 +04:00
|
|
|
" --version: print version information\n"
|
|
|
|
"\n", argv[0]);
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_HELP; //TODO: What is the correct return
|
2011-08-27 11:13:14 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("-a", argv[index]) == 0)
|
2011-07-22 08:53:54 +04:00
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing color depth\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
settings->color_depth = atoi(argv[index]);
|
|
|
|
}
|
|
|
|
else if (strcmp("-u", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing username\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-07-27 03:14:11 +04:00
|
|
|
settings->username = xstrdup(argv[index]);
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("-p", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing password\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-07-27 03:14:11 +04:00
|
|
|
settings->password = xstrdup(argv[index]);
|
2011-07-22 08:53:54 +04:00
|
|
|
settings->autologon = 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Overwrite original password which could be revealed by a simple "ps aux" command.
|
|
|
|
* This approach won't hide the password length, but it is better than nothing.
|
|
|
|
*/
|
|
|
|
|
|
|
|
memset(argv[index], '*', strlen(argv[index]));
|
|
|
|
}
|
|
|
|
else if (strcmp("-d", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing domain\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-07-27 03:14:11 +04:00
|
|
|
settings->domain = xstrdup(argv[index]);
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("-s", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing shell\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-07-27 03:14:11 +04:00
|
|
|
settings->shell = xstrdup(argv[index]);
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("-c", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing directory\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-07-27 03:14:11 +04:00
|
|
|
settings->directory = xstrdup(argv[index]);
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("-g", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
2011-08-17 22:13:44 +04:00
|
|
|
printf("missing dimensions\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-08-17 22:13:44 +04:00
|
|
|
|
|
|
|
if (strncmp("workarea", argv[index], 1) == 0)
|
2011-07-22 08:53:54 +04:00
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->workarea = true;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-17 22:13:44 +04:00
|
|
|
settings->width = (uint16) strtol(argv[index], &p, 10);
|
|
|
|
|
|
|
|
if (*p == 'x')
|
|
|
|
{
|
|
|
|
settings->height = (uint16) strtol(p + 1, &p, 10);
|
|
|
|
}
|
2011-11-02 03:53:49 +04:00
|
|
|
if (*p == '%')
|
|
|
|
{
|
|
|
|
settings->percent_screen = settings->width;
|
|
|
|
if (settings->percent_screen <= 0 || settings->percent_screen > 100)
|
|
|
|
{
|
|
|
|
printf("invalid geometry percentage\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-11-02 03:53:49 +04:00
|
|
|
}
|
|
|
|
}
|
2011-08-17 22:13:44 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ui_callback != NULL)
|
|
|
|
ui_callback(settings, "-g", p, ui_user_data);
|
|
|
|
}
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
}
|
2011-08-19 19:12:30 +04:00
|
|
|
else if (strcmp("-f", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->fullscreen = true;
|
2011-08-19 19:12:30 +04:00
|
|
|
}
|
2011-08-17 22:13:44 +04:00
|
|
|
else if (strcmp("-D", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->decorations = false;
|
2011-08-17 22:13:44 +04:00
|
|
|
}
|
2011-12-02 18:58:38 +04:00
|
|
|
else if (strcmp("-T", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing window title\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-12-02 18:58:38 +04:00
|
|
|
}
|
2011-12-09 22:53:19 +04:00
|
|
|
|
|
|
|
settings->window_title = xstrdup(argv[index]);
|
2011-12-02 18:58:38 +04:00
|
|
|
}
|
2011-07-22 08:53:54 +04:00
|
|
|
else if (strcmp("-t", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing port number\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
settings->port = atoi(argv[index]);
|
|
|
|
}
|
2011-08-26 05:35:51 +04:00
|
|
|
else if (strcmp("-k", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing keyboard layout id\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-08-26 05:35:51 +04:00
|
|
|
}
|
|
|
|
sscanf(argv[index], "%X", &(settings->kbd_layout));
|
|
|
|
}
|
2011-10-05 02:46:49 +04:00
|
|
|
else if (strcmp("-K", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->grab_keyboard = false;
|
2011-10-05 02:46:49 +04:00
|
|
|
}
|
2011-07-22 08:53:54 +04:00
|
|
|
else if (strcmp("-n", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing client hostname\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
strncpy(settings->client_hostname, argv[index], sizeof(settings->client_hostname) - 1);
|
|
|
|
settings->client_hostname[sizeof(settings->client_hostname) - 1] = 0;
|
|
|
|
}
|
|
|
|
else if (strcmp("-o", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->console_audio = true;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("-0", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->console_session = true;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("-z", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->compression = true;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-11-30 03:12:42 +04:00
|
|
|
else if (strcmp("--ntlm", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
|
|
|
|
settings->ntlm_version = atoi(argv[index]);
|
|
|
|
|
|
|
|
if (settings->ntlm_version != 2)
|
|
|
|
settings->ntlm_version = 1;
|
|
|
|
}
|
2011-12-15 02:08:22 +04:00
|
|
|
else if (strcmp("--no-glyph-cache", argv[index]) == 0)
|
2011-11-09 21:57:31 +04:00
|
|
|
{
|
2011-12-15 02:08:22 +04:00
|
|
|
settings->glyph_cache = false;
|
2011-11-09 21:57:31 +04:00
|
|
|
}
|
2011-07-22 08:53:54 +04:00
|
|
|
else if (strcmp("--no-osb", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->offscreen_bitmap_cache = false;
|
2011-10-10 05:23:18 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("--no-bmp-cache", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->bitmap_cache = false;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-08-18 21:07:52 +04:00
|
|
|
else if (strcmp("--no-auth", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->authentication = false;
|
2011-08-18 21:07:52 +04:00
|
|
|
}
|
2012-06-06 13:53:30 +04:00
|
|
|
else if (strcmp("--authonly", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
settings->authentication_only = true;
|
|
|
|
}
|
|
|
|
else if (strcmp("--from-stdin", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
settings->from_stdin = true;
|
|
|
|
}
|
2011-10-19 11:42:53 +04:00
|
|
|
else if (strcmp("--ignore-certificate", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->ignore_certificate = true;
|
2011-10-19 11:42:53 +04:00
|
|
|
}
|
2012-02-05 00:16:41 +04:00
|
|
|
else if (strcmp("--certificate-name", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing certificate name\n");
|
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
settings->certificate_name = xstrdup(argv[index]);
|
|
|
|
}
|
2011-08-16 10:37:11 +04:00
|
|
|
else if (strcmp("--no-fastpath", argv[index]) == 0)
|
2011-08-13 09:35:58 +04:00
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->fastpath_input = false;
|
|
|
|
settings->fastpath_output = false;
|
2011-08-13 09:35:58 +04:00
|
|
|
}
|
2011-08-26 22:48:51 +04:00
|
|
|
else if (strcmp("--gdi", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing GDI backend\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-08-26 22:48:51 +04:00
|
|
|
}
|
|
|
|
if (strncmp("sw", argv[index], 1) == 0) /* software */
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->sw_gdi = true;
|
2011-08-26 22:48:51 +04:00
|
|
|
}
|
|
|
|
else if (strncmp("hw", argv[index], 1) == 0) /* hardware */
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->sw_gdi = false;
|
2011-08-26 22:48:51 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("unknown GDI backend\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-08-26 22:48:51 +04:00
|
|
|
}
|
|
|
|
}
|
2011-07-22 08:53:54 +04:00
|
|
|
else if (strcmp("--rfx", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->rfx_codec = true;
|
|
|
|
settings->fastpath_output = true;
|
2011-07-22 08:53:54 +04:00
|
|
|
settings->color_depth = 32;
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->frame_acknowledge = false;
|
2011-07-22 08:53:54 +04:00
|
|
|
settings->performance_flags = PERF_FLAG_NONE;
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->large_pointer = true;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-11-25 16:09:16 +04:00
|
|
|
else if (strcmp("--rfx-mode", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing RemoteFX mode flag\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-11-25 16:09:16 +04:00
|
|
|
}
|
|
|
|
if (argv[index][0] == 'v') /* video */
|
|
|
|
{
|
|
|
|
settings->rfx_codec_mode = 0x00;
|
|
|
|
}
|
|
|
|
else if (argv[index][0] == 'i') /* image */
|
|
|
|
{
|
|
|
|
settings->rfx_codec_mode = 0x02;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("unknown RemoteFX mode flag\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-11-25 16:09:16 +04:00
|
|
|
}
|
|
|
|
}
|
2011-12-12 03:05:32 +04:00
|
|
|
else if (strcmp("--nsc", argv[index]) == 0)
|
2011-10-02 23:11:08 +04:00
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->ns_codec = true;
|
2011-10-02 23:11:08 +04:00
|
|
|
}
|
2011-08-27 04:26:40 +04:00
|
|
|
else if (strcmp("--dump-rfx", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing file name\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-08-27 04:26:40 +04:00
|
|
|
}
|
|
|
|
settings->dump_rfx_file = xstrdup(argv[index]);
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->dump_rfx = true;
|
2011-08-27 04:26:40 +04:00
|
|
|
}
|
2011-08-28 23:51:49 +04:00
|
|
|
else if (strcmp("--play-rfx", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing file name\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-08-28 23:51:49 +04:00
|
|
|
}
|
|
|
|
settings->play_rfx_file = xstrdup(argv[index]);
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->play_rfx = true;
|
2011-08-28 23:51:49 +04:00
|
|
|
}
|
2011-09-23 08:06:39 +04:00
|
|
|
else if (strcmp("--fonts", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->smooth_fonts = true;
|
2011-09-23 08:06:39 +04:00
|
|
|
}
|
2011-12-16 21:04:09 +04:00
|
|
|
else if (strcmp("--disable-wallpaper", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
settings->disable_wallpaper = true;
|
|
|
|
}
|
|
|
|
else if (strcmp("--disable-full-window-drag", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
settings->disable_full_window_drag = true;
|
|
|
|
}
|
|
|
|
else if (strcmp("--disable-menu-animations", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
settings->disable_menu_animations = true;
|
|
|
|
}
|
|
|
|
else if (strcmp("--disable-theming", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
settings->disable_theming = true;
|
|
|
|
}
|
2011-12-13 04:20:52 +04:00
|
|
|
else if (strcmp("--composition", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
settings->desktop_composition = true;
|
|
|
|
}
|
2011-09-02 20:39:56 +04:00
|
|
|
else if (strcmp("--no-motion", argv[index]) == 0)
|
2011-07-22 08:53:54 +04:00
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->mouse_motion = false;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-08-15 04:41:42 +04:00
|
|
|
else if (strcmp("--app", argv[index]) == 0)
|
2011-07-22 08:53:54 +04:00
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->remote_app = true;
|
|
|
|
settings->rail_langbar_supported = true;
|
|
|
|
settings->workarea = true;
|
2011-08-23 23:52:17 +04:00
|
|
|
settings->performance_flags = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("-x", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing performance flag\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
if (argv[index][0] == 'm') /* modem */
|
|
|
|
{
|
|
|
|
settings->performance_flags = PERF_DISABLE_WALLPAPER |
|
|
|
|
PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS |
|
|
|
|
PERF_DISABLE_THEMING;
|
2011-12-16 21:14:16 +04:00
|
|
|
|
|
|
|
settings->connection_type = CONNECTION_TYPE_MODEM;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (argv[index][0] == 'b') /* broadband */
|
|
|
|
{
|
|
|
|
settings->performance_flags = PERF_DISABLE_WALLPAPER;
|
2011-12-16 21:14:16 +04:00
|
|
|
settings->connection_type = CONNECTION_TYPE_BROADBAND_HIGH;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (argv[index][0] == 'l') /* lan */
|
|
|
|
{
|
|
|
|
settings->performance_flags = PERF_FLAG_NONE;
|
2011-12-16 21:14:16 +04:00
|
|
|
settings->connection_type = CONNECTION_TYPE_LAN;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
settings->performance_flags = strtol(argv[index], 0, 16);
|
|
|
|
}
|
|
|
|
}
|
2011-12-09 22:53:19 +04:00
|
|
|
else if (strcmp("-X", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing parent window XID\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-12-09 22:53:19 +04:00
|
|
|
}
|
|
|
|
|
2012-05-04 22:47:54 +04:00
|
|
|
settings->parent_window_xid = strtol(argv[index], NULL, 0);
|
2011-12-09 22:53:19 +04:00
|
|
|
|
|
|
|
if (settings->parent_window_xid == 0)
|
|
|
|
{
|
|
|
|
printf("invalid parent window XID\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-12-09 22:53:19 +04:00
|
|
|
}
|
|
|
|
}
|
2011-07-22 08:53:54 +04:00
|
|
|
else if (strcmp("--no-rdp", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->rdp_security = false;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("--no-tls", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->tls_security = false;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("--no-nla", argv[index]) == 0)
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->nla_security = false;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("--sec", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing protocol security\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
if (strncmp("rdp", argv[index], 1) == 0) /* Standard RDP */
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->rdp_security = true;
|
|
|
|
settings->tls_security = false;
|
|
|
|
settings->nla_security = false;
|
|
|
|
settings->encryption = true;
|
2011-09-16 03:54:03 +04:00
|
|
|
settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
|
|
|
|
settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strncmp("tls", argv[index], 1) == 0) /* TLS */
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->rdp_security = false;
|
|
|
|
settings->tls_security = true;
|
|
|
|
settings->nla_security = false;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strncmp("nla", argv[index], 1) == 0) /* NLA */
|
|
|
|
{
|
2011-11-19 21:19:16 +04:00
|
|
|
settings->rdp_security = false;
|
|
|
|
settings->tls_security = false;
|
|
|
|
settings->nla_security = true;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("unknown protocol security\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp("--plugin", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
2011-08-02 09:15:25 +04:00
|
|
|
t = index;
|
2011-07-22 08:53:54 +04:00
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing plugin name\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
2011-08-04 19:00:45 +04:00
|
|
|
plugin_data = NULL;
|
2012-03-13 13:05:14 +04:00
|
|
|
if (strstr(argv[t], "rdpsnd"))
|
|
|
|
settings->audio_playback = true;
|
2011-07-22 08:53:54 +04:00
|
|
|
if (index < argc - 1 && strcmp("--data", argv[index + 1]) == 0)
|
|
|
|
{
|
|
|
|
index += 2;
|
|
|
|
i = 0;
|
2011-08-04 19:00:45 +04:00
|
|
|
while (index < argc && strcmp("--", argv[index]) != 0)
|
2011-07-22 08:53:54 +04:00
|
|
|
{
|
2012-02-02 03:51:41 +04:00
|
|
|
if (plugin_data == NULL)
|
|
|
|
plugin_data = (RDP_PLUGIN_DATA*) xmalloc(sizeof(RDP_PLUGIN_DATA) * (i + 2));
|
|
|
|
else
|
|
|
|
plugin_data = (RDP_PLUGIN_DATA*) xrealloc(plugin_data, sizeof(RDP_PLUGIN_DATA) * (i + 2));
|
|
|
|
|
2012-03-13 13:05:14 +04:00
|
|
|
if (strstr(argv[t], "drdynvc") && strstr(argv[index], "audin"))
|
|
|
|
settings->audio_capture = true;
|
|
|
|
|
2011-08-18 01:28:26 +04:00
|
|
|
plugin_data[i].size = sizeof(RDP_PLUGIN_DATA);
|
2011-08-17 17:56:05 +04:00
|
|
|
plugin_data[i].data[0] = NULL;
|
|
|
|
plugin_data[i].data[1] = NULL;
|
|
|
|
plugin_data[i].data[2] = NULL;
|
|
|
|
plugin_data[i].data[3] = NULL;
|
2011-08-04 19:00:45 +04:00
|
|
|
plugin_data[i + 1].size = 0;
|
2012-02-02 03:51:41 +04:00
|
|
|
|
2011-07-22 08:53:54 +04:00
|
|
|
for (j = 0, p = argv[index]; j < 4 && p != NULL; j++)
|
|
|
|
{
|
|
|
|
if (*p == '\'')
|
|
|
|
{
|
|
|
|
plugin_data[i].data[j] = p + 1;
|
|
|
|
p = strchr(p + 1, '\'');
|
|
|
|
if (p)
|
|
|
|
*p++ = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
plugin_data[i].data[j] = p;
|
|
|
|
|
|
|
|
p = strchr(p, ':');
|
|
|
|
if (p != NULL)
|
|
|
|
*p++ = 0;
|
|
|
|
}
|
|
|
|
index++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2011-07-28 19:09:51 +04:00
|
|
|
|
|
|
|
if (plugin_callback != NULL)
|
|
|
|
{
|
|
|
|
if (!plugin_callback(settings, argv[t], plugin_data, plugin_user_data))
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-28 19:09:51 +04:00
|
|
|
}
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("--ext", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
if (index == argc)
|
|
|
|
{
|
|
|
|
printf("missing extension name\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
if (num_extensions >= sizeof(settings->extensions) / sizeof(struct rdp_ext_set))
|
|
|
|
{
|
|
|
|
printf("maximum extensions reached\n");
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
snprintf(settings->extensions[num_extensions].name,
|
|
|
|
sizeof(settings->extensions[num_extensions].name),
|
|
|
|
"%s", argv[index]);
|
|
|
|
settings->extensions[num_extensions].data = NULL;
|
|
|
|
if (index < argc - 1 && strcmp("--data", argv[index + 1]) == 0)
|
|
|
|
{
|
|
|
|
index += 2;
|
|
|
|
settings->extensions[num_extensions].data = argv[index];
|
|
|
|
i = 0;
|
|
|
|
while (index < argc && strcmp("--", argv[index]) != 0)
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
num_extensions++;
|
|
|
|
}
|
2012-01-25 19:06:31 +04:00
|
|
|
else if (strcmp("--secure-checksum", argv[index]) == 0)
|
|
|
|
{
|
|
|
|
settings->secure_checksum = true;
|
|
|
|
}
|
2011-07-22 08:53:54 +04:00
|
|
|
else if (strcmp("--version", argv[index]) == 0)
|
|
|
|
{
|
2012-11-19 19:21:37 +04:00
|
|
|
if (strlen(FREERDP_VERSION_SUFFIX))
|
|
|
|
printf("This is FreeRDP version %s-%s\n", FREERDP_VERSION_FULL, FREERDP_VERSION_SUFFIX);
|
|
|
|
else
|
|
|
|
printf("This is FreeRDP version %s\n", FREERDP_VERSION_FULL);
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_VERSION;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else if (argv[index][0] != '-')
|
|
|
|
{
|
2012-06-06 13:53:30 +04:00
|
|
|
freerdp_parse_hostname(settings, argv[index]);
|
|
|
|
|
2011-07-22 08:53:54 +04:00
|
|
|
/* server is the last argument for the current session. arguments
|
|
|
|
followed will be parsed for the next session. */
|
|
|
|
index++;
|
|
|
|
|
2011-09-23 08:06:39 +04:00
|
|
|
if (settings->smooth_fonts)
|
|
|
|
settings->performance_flags |= PERF_ENABLE_FONT_SMOOTHING;
|
|
|
|
|
2011-12-13 04:20:52 +04:00
|
|
|
if (settings->desktop_composition)
|
|
|
|
settings->performance_flags |= PERF_ENABLE_DESKTOP_COMPOSITION;
|
|
|
|
|
2011-12-16 21:04:09 +04:00
|
|
|
if (settings->disable_wallpaper)
|
|
|
|
settings->performance_flags |= PERF_DISABLE_WALLPAPER;
|
|
|
|
|
|
|
|
if (settings->disable_full_window_drag)
|
|
|
|
settings->performance_flags |= PERF_DISABLE_FULLWINDOWDRAG;
|
|
|
|
|
|
|
|
if (settings->disable_menu_animations)
|
|
|
|
settings->performance_flags |= PERF_DISABLE_MENUANIMATIONS;
|
|
|
|
|
|
|
|
if (settings->disable_theming)
|
|
|
|
settings->performance_flags |= PERF_DISABLE_THEMING;
|
|
|
|
|
2012-06-06 13:53:30 +04:00
|
|
|
break; /* post process missing arguments */
|
|
|
|
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-07-28 19:09:51 +04:00
|
|
|
if (ui_callback != NULL)
|
2011-07-22 08:53:54 +04:00
|
|
|
{
|
2011-07-28 19:09:51 +04:00
|
|
|
t = ui_callback(settings, argv[index], (index + 1 < argc && argv[index + 1][0] != '-' ?
|
|
|
|
argv[index + 1] : NULL), ui_user_data);
|
|
|
|
if (t == 0)
|
|
|
|
{
|
|
|
|
printf("invalid option: %s\n", argv[index]);
|
2012-01-15 01:30:48 +04:00
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2011-07-28 19:09:51 +04:00
|
|
|
}
|
|
|
|
index += t - 1;
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
index++;
|
|
|
|
}
|
2012-06-06 13:53:30 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* --from-stdin will prompt for missing arguments only.
|
|
|
|
You can prompt for username, password, domain and hostname to avoid disclosing
|
|
|
|
these settings to ps. */
|
|
|
|
|
2012-10-28 03:24:07 +04:00
|
|
|
if (settings->from_stdin)
|
|
|
|
{
|
2012-06-06 13:53:30 +04:00
|
|
|
/* username */
|
2012-10-28 03:24:07 +04:00
|
|
|
if (NULL == settings->username)
|
|
|
|
{
|
2012-06-06 13:53:30 +04:00
|
|
|
char input[512];
|
2012-09-07 07:11:01 +04:00
|
|
|
input[0] = '\0';
|
2012-06-06 13:53:30 +04:00
|
|
|
printf("username: ");
|
2012-10-28 03:46:33 +04:00
|
|
|
if (scanf("%511s%*c", input) > 0)
|
2012-10-28 03:24:07 +04:00
|
|
|
{
|
2012-09-07 07:11:01 +04:00
|
|
|
settings->username = xstrdup(input);
|
|
|
|
}
|
2012-06-06 13:53:30 +04:00
|
|
|
}
|
|
|
|
/* password */
|
2012-10-28 03:24:07 +04:00
|
|
|
if (NULL == settings->password)
|
|
|
|
{
|
2012-09-07 17:11:33 +04:00
|
|
|
settings->password = xmalloc(512 * sizeof(char));
|
|
|
|
if (isatty(STDIN_FILENO))
|
2012-10-28 03:46:33 +04:00
|
|
|
{
|
2012-09-07 17:11:33 +04:00
|
|
|
freerdp_passphrase_read("password: ", settings->password, 512, settings->from_stdin);
|
2012-10-28 03:46:33 +04:00
|
|
|
}
|
2012-10-28 03:24:07 +04:00
|
|
|
else
|
|
|
|
{
|
2012-09-07 17:11:33 +04:00
|
|
|
printf("password: ");
|
2012-10-28 03:46:33 +04:00
|
|
|
if (scanf("%511s%*c", settings->password) <= 0)
|
2012-10-28 03:24:07 +04:00
|
|
|
{
|
2012-09-07 17:11:33 +04:00
|
|
|
free(settings->password);
|
|
|
|
settings->password = NULL;
|
|
|
|
}
|
2012-08-15 01:50:10 +04:00
|
|
|
}
|
2012-06-06 13:53:30 +04:00
|
|
|
}
|
|
|
|
/* domain */
|
2012-10-28 03:24:07 +04:00
|
|
|
if (NULL == settings->domain)
|
|
|
|
{
|
2012-06-06 13:53:30 +04:00
|
|
|
char input[512];
|
2012-09-07 07:11:01 +04:00
|
|
|
input[0] = '\0';
|
2012-06-06 13:53:30 +04:00
|
|
|
printf("domain (control-D to skip): ");
|
2012-10-28 03:46:33 +04:00
|
|
|
if (scanf("%511s%*c", input) > 0)
|
2012-10-28 03:24:07 +04:00
|
|
|
{
|
2012-09-07 07:11:01 +04:00
|
|
|
/* Try to catch the cases where the string is NULL-ish right
|
|
|
|
at the get go */
|
2012-10-28 03:24:07 +04:00
|
|
|
if (input[0] != '\0' && !(input[0] == '.' && input[1] == '\0'))
|
|
|
|
{
|
2012-09-07 07:11:01 +04:00
|
|
|
settings->domain = xstrdup(input);
|
|
|
|
}
|
|
|
|
}
|
2012-10-28 03:46:33 +04:00
|
|
|
if (feof(stdin))
|
|
|
|
{
|
|
|
|
printf("\n");
|
|
|
|
clearerr(stdin);
|
|
|
|
}
|
2012-06-06 13:53:30 +04:00
|
|
|
}
|
|
|
|
/* hostname */
|
2012-10-28 03:24:07 +04:00
|
|
|
if (NULL == settings->hostname)
|
|
|
|
{
|
2012-06-06 13:53:30 +04:00
|
|
|
char input[512];
|
2012-09-07 07:11:01 +04:00
|
|
|
input[0] = '\0';
|
2012-06-06 13:53:30 +04:00
|
|
|
printf("hostname: ");
|
2012-10-28 03:46:33 +04:00
|
|
|
if (scanf("%511s%*c", input) > 0)
|
2012-10-28 03:24:07 +04:00
|
|
|
{
|
2012-09-07 07:11:01 +04:00
|
|
|
freerdp_parse_hostname(settings, input);
|
|
|
|
}
|
2012-06-06 13:53:30 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Must have a hostname. Do you? */
|
2012-10-28 03:24:07 +04:00
|
|
|
if (NULL == settings->hostname)
|
|
|
|
{
|
2012-06-06 13:53:30 +04:00
|
|
|
printf("missing server name\n");
|
|
|
|
return FREERDP_ARGS_PARSE_FAILURE;
|
2012-10-28 03:24:07 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-06 13:53:30 +04:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
2011-07-22 08:53:54 +04:00
|
|
|
}
|