1 |
/* -*- c-basic-offset: 8 -*- |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Entrypoint and utility functions |
Entrypoint and utility functions |
4 |
Copyright (C) Matthew Chapman 1999-2003 |
Copyright (C) Matthew Chapman 1999-2005 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
49 |
absolute value specifies the |
absolute value specifies the |
50 |
percent of the whole screen. */ |
percent of the whole screen. */ |
51 |
int g_height = 600; |
int g_height = 600; |
52 |
|
int g_xpos = 0; |
53 |
|
int g_ypos = 0; |
54 |
extern int g_tcp_port_rdp; |
extern int g_tcp_port_rdp; |
55 |
int g_server_bpp = 8; |
int g_server_bpp = 8; |
56 |
int g_win_button_size = 0; /* If zero, disable single app mode */ |
int g_win_button_size = 0; /* If zero, disable single app mode */ |
61 |
BOOL g_bitmap_cache_precache = True; |
BOOL g_bitmap_cache_precache = True; |
62 |
BOOL g_encryption = True; |
BOOL g_encryption = True; |
63 |
BOOL packet_encryption = True; |
BOOL packet_encryption = True; |
64 |
BOOL g_desktop_save = True; |
BOOL g_desktop_save = True; /* desktop save order */ |
65 |
|
BOOL g_polygon_ellipse_orders = True; /* polygon / ellipse orders */ |
66 |
BOOL g_fullscreen = False; |
BOOL g_fullscreen = False; |
67 |
BOOL g_grab_keyboard = True; |
BOOL g_grab_keyboard = True; |
68 |
BOOL g_hide_decorations = False; |
BOOL g_hide_decorations = False; |
95 |
usage(char *program) |
usage(char *program) |
96 |
{ |
{ |
97 |
fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); |
fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); |
98 |
fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2003 Matt Chapman.\n"); |
fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2005 Matt Chapman.\n"); |
99 |
fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); |
fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); |
100 |
|
|
101 |
fprintf(stderr, "Usage: %s [options] server[:port]\n", program); |
fprintf(stderr, "Usage: %s [options] server[:port]\n", program); |
125 |
fprintf(stderr, " -N: enable numlock syncronization\n"); |
fprintf(stderr, " -N: enable numlock syncronization\n"); |
126 |
fprintf(stderr, " -X: embed into another window with a given id.\n"); |
fprintf(stderr, " -X: embed into another window with a given id.\n"); |
127 |
fprintf(stderr, " -a: connection colour depth\n"); |
fprintf(stderr, " -a: connection colour depth\n"); |
128 |
|
fprintf(stderr, " -z: enable rdp compression\n"); |
129 |
fprintf(stderr, " -x: RDP5 experience (m[odem 28.8], b[roadband], l[an] or hex nr.)\n"); |
fprintf(stderr, " -x: RDP5 experience (m[odem 28.8], b[roadband], l[an] or hex nr.)\n"); |
130 |
fprintf(stderr, " -P: use persistent bitmap caching\n"); |
fprintf(stderr, " -P: use persistent bitmap caching\n"); |
131 |
fprintf(stderr, " -r: enable specified device redirection (this flag can be repeated)\n"); |
fprintf(stderr, " -r: enable specified device redirection (this flag can be repeated)\n"); |
133 |
" '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n"); |
" '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n"); |
134 |
fprintf(stderr, " or COM1=/dev/ttyS0,COM2=/dev/ttyS1\n"); |
fprintf(stderr, " or COM1=/dev/ttyS0,COM2=/dev/ttyS1\n"); |
135 |
fprintf(stderr, |
fprintf(stderr, |
136 |
" '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n"); |
" '-r disk:floppy=/mnt/floppy': enable redirection of /mnt/floppy to 'floppy' share\n"); |
137 |
fprintf(stderr, " or A=/mnt/floppy,D=/mnt/cdrom'\n"); |
fprintf(stderr, " or 'floppy=/mnt/floppy,cdrom=/mnt/cdrom'\n"); |
138 |
fprintf(stderr, " '-r clientname=<client name>': Set the client name displayed\n"); |
fprintf(stderr, " '-r clientname=<client name>': Set the client name displayed\n"); |
139 |
fprintf(stderr, " for redirected disks\n"); |
fprintf(stderr, " for redirected disks\n"); |
140 |
fprintf(stderr, |
fprintf(stderr, |
367 |
#endif |
#endif |
368 |
|
|
369 |
while ((c = getopt(argc, argv, |
while ((c = getopt(argc, argv, |
370 |
VNCOPT "u:d:s:c:p:n:k:g:fbBeEmCDKS:T:NX:a:x:Pr:045h?")) != -1) |
VNCOPT "u:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1) |
371 |
{ |
{ |
372 |
switch (c) |
switch (c) |
373 |
{ |
{ |
442 |
} |
} |
443 |
|
|
444 |
if (*p == 'x') |
if (*p == 'x') |
445 |
g_height = strtol(p + 1, NULL, 10); |
g_height = strtol(p + 1, &p, 10); |
446 |
|
|
447 |
if (g_height <= 0) |
if (g_height <= 0) |
448 |
{ |
{ |
451 |
} |
} |
452 |
|
|
453 |
if (*p == '%') |
if (*p == '%') |
454 |
|
{ |
455 |
g_width = -g_width; |
g_width = -g_width; |
456 |
|
p++; |
457 |
|
} |
458 |
|
|
459 |
|
if (*p == '+' || *p == '-') |
460 |
|
g_xpos = strtol(p, &p, 10); |
461 |
|
|
462 |
|
if (*p == '+' || *p == '-') |
463 |
|
g_ypos = strtol(p, NULL, 10); |
464 |
|
|
465 |
break; |
break; |
466 |
|
|
537 |
} |
} |
538 |
break; |
break; |
539 |
|
|
540 |
case 'x': |
case 'z': |
541 |
|
DEBUG(("rdp compression enabled\n")); |
542 |
|
flags |= RDP_COMPRESSION; |
543 |
|
break; |
544 |
|
|
545 |
|
case 'x': |
546 |
if (strncmp("modem", optarg, 1) == 0) |
if (strncmp("modem", optarg, 1) == 0) |
547 |
{ |
{ |
548 |
g_rdp5_performanceflags = |
g_rdp5_performanceflags = |
691 |
STRNCPY(g_hostname, fullhostname, sizeof(g_hostname)); |
STRNCPY(g_hostname, fullhostname, sizeof(g_hostname)); |
692 |
} |
} |
693 |
|
|
694 |
|
if ((flags & RDP_COMPRESSION) && (g_server_bpp > 8)) |
695 |
|
{ |
696 |
|
warning("rdp compression not supported for bpp > 8, compression disabled\n"); |
697 |
|
flags ^= RDP_COMPRESSION; |
698 |
|
} |
699 |
|
|
700 |
if (prompt_password && read_password(password, sizeof(password))) |
if (prompt_password && read_password(password, sizeof(password))) |
701 |
flags |= RDP_LOGON_AUTO; |
flags |= RDP_LOGON_AUTO; |
702 |
|
|
870 |
void * |
void * |
871 |
xrealloc(void *oldmem, int size) |
xrealloc(void *oldmem, int size) |
872 |
{ |
{ |
873 |
void *mem = realloc(oldmem, size); |
void *mem; |
874 |
|
|
875 |
|
if (size < 1) |
876 |
|
size = 1; |
877 |
|
mem = realloc(oldmem, size); |
878 |
if (mem == NULL) |
if (mem == NULL) |
879 |
{ |
{ |
880 |
error("xrealloc %d\n", size); |
error("xrealloc %d\n", size); |