27 |
#include <sys/time.h> /* gettimeofday */ |
#include <sys/time.h> /* gettimeofday */ |
28 |
#include <sys/times.h> /* times */ |
#include <sys/times.h> /* times */ |
29 |
#include <ctype.h> /* toupper */ |
#include <ctype.h> /* toupper */ |
|
#include <limits.h> /* PATH_MAX */ |
|
30 |
#include <errno.h> |
#include <errno.h> |
31 |
#include "rdesktop.h" |
#include "rdesktop.h" |
32 |
|
|
51 |
char g_username[64]; |
char g_username[64]; |
52 |
char g_hostname[16]; |
char g_hostname[16]; |
53 |
char g_keymapname[PATH_MAX] = ""; |
char g_keymapname[PATH_MAX] = ""; |
54 |
int g_keylayout = 0x409; /* Defaults to US keyboard layout */ |
unsigned int g_keylayout = 0x409; /* Defaults to US keyboard layout */ |
55 |
int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */ |
int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */ |
56 |
int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */ |
int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */ |
57 |
int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */ |
int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */ |
69 |
2 xpos neg, |
2 xpos neg, |
70 |
4 ypos neg */ |
4 ypos neg */ |
71 |
extern int g_tcp_port_rdp; |
extern int g_tcp_port_rdp; |
72 |
int g_server_bpp = 8; |
int g_server_depth = 8; |
73 |
int g_win_button_size = 0; /* If zero, disable single app mode */ |
int g_win_button_size = 0; /* If zero, disable single app mode */ |
74 |
BOOL g_bitmap_compression = True; |
BOOL g_bitmap_compression = True; |
75 |
BOOL g_sendmotion = True; |
BOOL g_sendmotion = True; |
380 |
char fullhostname[64]; |
char fullhostname[64]; |
381 |
char domain[16]; |
char domain[16]; |
382 |
char password[64]; |
char password[64]; |
383 |
char shell[128]; |
char shell[256]; |
384 |
char directory[32]; |
char directory[32]; |
385 |
BOOL prompt_password, deactivated; |
BOOL prompt_password, deactivated; |
386 |
struct passwd *pw; |
struct passwd *pw; |
590 |
break; |
break; |
591 |
|
|
592 |
case 'a': |
case 'a': |
593 |
g_server_bpp = strtol(optarg, NULL, 10); |
g_server_depth = strtol(optarg, NULL, 10); |
594 |
if (g_server_bpp != 8 && g_server_bpp != 16 && g_server_bpp != 15 |
if (g_server_depth != 8 && |
595 |
&& g_server_bpp != 24) |
g_server_depth != 16 && |
596 |
|
g_server_depth != 15 && g_server_depth != 24) |
597 |
{ |
{ |
598 |
error("invalid server bpp\n"); |
error("Invalid server colour depth.\n"); |
599 |
return 1; |
return 1; |
600 |
} |
} |
601 |
break; |
break; |
606 |
break; |
break; |
607 |
|
|
608 |
case 'x': |
case 'x': |
609 |
if (strncmp("modem", optarg, 1) == 0) |
if (str_startswith(optarg, "m")) /* modem */ |
610 |
{ |
{ |
611 |
g_rdp5_performanceflags = |
g_rdp5_performanceflags = |
612 |
RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | |
RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | |
613 |
RDP5_NO_MENUANIMATIONS | RDP5_NO_THEMING; |
RDP5_NO_MENUANIMATIONS | RDP5_NO_THEMING; |
614 |
} |
} |
615 |
else if (strncmp("broadband", optarg, 1) == 0) |
else if (str_startswith(optarg, "b")) /* broadband */ |
616 |
{ |
{ |
617 |
g_rdp5_performanceflags = RDP5_NO_WALLPAPER; |
g_rdp5_performanceflags = RDP5_NO_WALLPAPER; |
618 |
} |
} |
619 |
else if (strncmp("lan", optarg, 1) == 0) |
else if (str_startswith(optarg, "l")) /* lan */ |
620 |
{ |
{ |
621 |
g_rdp5_performanceflags = RDP5_DISABLE_NOTHING; |
g_rdp5_performanceflags = RDP5_DISABLE_NOTHING; |
622 |
} |
} |
632 |
|
|
633 |
case 'r': |
case 'r': |
634 |
|
|
635 |
if (strncmp("sound", optarg, 5) == 0) |
if (str_startswith(optarg, "sound")) |
636 |
{ |
{ |
637 |
optarg += 5; |
optarg += 5; |
638 |
|
|
641 |
*optarg++; |
*optarg++; |
642 |
while ((p = next_arg(optarg, ','))) |
while ((p = next_arg(optarg, ','))) |
643 |
{ |
{ |
644 |
if (strncmp("remote", optarg, 6) == 0) |
if (str_startswith(optarg, "remote")) |
645 |
flags |= RDP_LOGON_LEAVE_AUDIO; |
flags |= RDP_LOGON_LEAVE_AUDIO; |
646 |
|
|
647 |
if (strncmp("local", optarg, 5) == 0) |
if (str_startswith(optarg, "local")) |
648 |
#ifdef WITH_RDPSND |
#ifdef WITH_RDPSND |
649 |
g_rdpsnd = True; |
g_rdpsnd = True; |
650 |
#else |
#else |
651 |
warning("Not compiled with sound support\n"); |
warning("Not compiled with sound support\n"); |
652 |
#endif |
#endif |
653 |
|
|
654 |
if (strncmp("off", optarg, 3) == 0) |
if (str_startswith(optarg, "off")) |
655 |
#ifdef WITH_RDPSND |
#ifdef WITH_RDPSND |
656 |
g_rdpsnd = False; |
g_rdpsnd = False; |
657 |
#else |
#else |
670 |
#endif |
#endif |
671 |
} |
} |
672 |
} |
} |
673 |
else if (strncmp("disk", optarg, 4) == 0) |
else if (str_startswith(optarg, "disk")) |
674 |
{ |
{ |
675 |
/* -r disk:h:=/mnt/floppy */ |
/* -r disk:h:=/mnt/floppy */ |
676 |
disk_enum_devices(&g_num_devices, optarg + 4); |
disk_enum_devices(&g_num_devices, optarg + 4); |
677 |
} |
} |
678 |
else if (strncmp("comport", optarg, 7) == 0) |
else if (str_startswith(optarg, "comport")) |
679 |
{ |
{ |
680 |
serial_enum_devices(&g_num_devices, optarg + 7); |
serial_enum_devices(&g_num_devices, optarg + 7); |
681 |
} |
} |
682 |
else if (strncmp("lptport", optarg, 7) == 0) |
else if (str_startswith(optarg, "lptport")) |
683 |
{ |
{ |
684 |
parallel_enum_devices(&g_num_devices, optarg + 7); |
parallel_enum_devices(&g_num_devices, optarg + 7); |
685 |
} |
} |
686 |
else if (strncmp("printer", optarg, 7) == 0) |
else if (str_startswith(optarg, "printer")) |
687 |
{ |
{ |
688 |
printer_enum_devices(&g_num_devices, optarg + 7); |
printer_enum_devices(&g_num_devices, optarg + 7); |
689 |
} |
} |
690 |
else if (strncmp("clientname", optarg, 7) == 0) |
else if (str_startswith(optarg, "clientname")) |
691 |
{ |
{ |
692 |
g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1); |
g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1); |
693 |
strcpy(g_rdpdr_clientname, optarg + 11); |
strcpy(g_rdpdr_clientname, optarg + 11); |
1171 |
} |
} |
1172 |
|
|
1173 |
|
|
1174 |
|
BOOL |
1175 |
|
str_startswith(const char *s, const char *prefix) |
1176 |
|
{ |
1177 |
|
return (strncmp(s, prefix, strlen(prefix)) == 0); |
1178 |
|
} |
1179 |
|
|
1180 |
|
|
1181 |
/* not all clibs got ltoa */ |
/* not all clibs got ltoa */ |
1182 |
#define LTOA_BUFSIZE (sizeof(long) * 8 + 1) |
#define LTOA_BUFSIZE (sizeof(long) * 8 + 1) |
1183 |
|
|