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 |
30 |
#include <errno.h> |
#include <errno.h> |
31 |
#include "rdesktop.h" |
#include "rdesktop.h" |
32 |
|
|
33 |
|
#ifdef HAVE_ICONV |
34 |
|
#ifdef HAVE_LOCALE_H |
35 |
|
#include <locale.h> |
36 |
|
#endif |
37 |
|
#ifdef HAVE_LANGINFO_H |
38 |
|
#include <langinfo.h> |
39 |
|
#endif |
40 |
|
#endif |
41 |
|
|
42 |
#ifdef EGD_SOCKET |
#ifdef EGD_SOCKET |
43 |
#include <sys/socket.h> /* socket connect */ |
#include <sys/socket.h> /* socket connect */ |
44 |
#include <sys/un.h> /* sockaddr_un */ |
#include <sys/un.h> /* sockaddr_un */ |
70 |
BOOL g_bitmap_cache_precache = True; |
BOOL g_bitmap_cache_precache = True; |
71 |
BOOL g_encryption = True; |
BOOL g_encryption = True; |
72 |
BOOL packet_encryption = True; |
BOOL packet_encryption = True; |
73 |
BOOL g_desktop_save = True; |
BOOL g_desktop_save = True; /* desktop save order */ |
74 |
|
BOOL g_polygon_ellipse_orders = True; /* polygon / ellipse orders */ |
75 |
BOOL g_fullscreen = False; |
BOOL g_fullscreen = False; |
76 |
BOOL g_grab_keyboard = True; |
BOOL g_grab_keyboard = True; |
77 |
BOOL g_hide_decorations = False; |
BOOL g_hide_decorations = False; |
88 |
BOOL g_rdpsnd = False; |
BOOL g_rdpsnd = False; |
89 |
#endif |
#endif |
90 |
|
|
91 |
|
#ifdef HAVE_ICONV |
92 |
|
char g_codepage[16] = ""; |
93 |
|
#endif |
94 |
|
|
95 |
extern RDPDR_DEVICE g_rdpdr_device[]; |
extern RDPDR_DEVICE g_rdpdr_device[]; |
96 |
extern uint32 g_num_devices; |
extern uint32 g_num_devices; |
97 |
extern char *g_rdpdr_clientname; |
extern char *g_rdpdr_clientname; |
108 |
usage(char *program) |
usage(char *program) |
109 |
{ |
{ |
110 |
fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); |
fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); |
111 |
fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2003 Matt Chapman.\n"); |
fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2005 Matt Chapman.\n"); |
112 |
fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); |
fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); |
113 |
|
|
114 |
fprintf(stderr, "Usage: %s [options] server[:port]\n", program); |
fprintf(stderr, "Usage: %s [options] server[:port]\n", program); |
126 |
fprintf(stderr, " -g: desktop geometry (WxH)\n"); |
fprintf(stderr, " -g: desktop geometry (WxH)\n"); |
127 |
fprintf(stderr, " -f: full-screen mode\n"); |
fprintf(stderr, " -f: full-screen mode\n"); |
128 |
fprintf(stderr, " -b: force bitmap updates\n"); |
fprintf(stderr, " -b: force bitmap updates\n"); |
129 |
|
#ifdef HAVE_ICONV |
130 |
|
fprintf(stderr, " -L: local codepage\n"); |
131 |
|
#endif |
132 |
fprintf(stderr, " -B: use BackingStore of X-server (if available)\n"); |
fprintf(stderr, " -B: use BackingStore of X-server (if available)\n"); |
133 |
fprintf(stderr, " -e: disable encryption (French TS)\n"); |
fprintf(stderr, " -e: disable encryption (French TS)\n"); |
134 |
fprintf(stderr, " -E: disable encryption from client to server\n"); |
fprintf(stderr, " -E: disable encryption from client to server\n"); |
383 |
#endif |
#endif |
384 |
|
|
385 |
while ((c = getopt(argc, argv, |
while ((c = getopt(argc, argv, |
386 |
VNCOPT "u:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1) |
VNCOPT "u:L:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1) |
387 |
{ |
{ |
388 |
switch (c) |
switch (c) |
389 |
{ |
{ |
406 |
username_option = 1; |
username_option = 1; |
407 |
break; |
break; |
408 |
|
|
409 |
|
case 'L': |
410 |
|
#ifdef HAVE_ICONV |
411 |
|
STRNCPY(g_codepage, optarg, sizeof(g_codepage)); |
412 |
|
#else |
413 |
|
error("iconv support not available\n"); |
414 |
|
#endif |
415 |
|
break; |
416 |
|
|
417 |
case 'd': |
case 'd': |
418 |
STRNCPY(domain, optarg, sizeof(domain)); |
STRNCPY(domain, optarg, sizeof(domain)); |
419 |
break; |
break; |
700 |
STRNCPY(g_username, pw->pw_name, sizeof(g_username)); |
STRNCPY(g_username, pw->pw_name, sizeof(g_username)); |
701 |
} |
} |
702 |
|
|
703 |
|
#ifdef HAVE_ICONV |
704 |
|
if (g_codepage[0] == 0) |
705 |
|
{ |
706 |
|
if (setlocale(LC_CTYPE, "")) |
707 |
|
{ |
708 |
|
STRNCPY(g_codepage, nl_langinfo(CODESET), sizeof(g_codepage)); |
709 |
|
} |
710 |
|
else |
711 |
|
{ |
712 |
|
STRNCPY(g_codepage, DEFAULT_CODEPAGE, sizeof(g_codepage)); |
713 |
|
} |
714 |
|
} |
715 |
|
#endif |
716 |
|
|
717 |
if (g_hostname[0] == 0) |
if (g_hostname[0] == 0) |
718 |
{ |
{ |
719 |
if (gethostname(fullhostname, sizeof(fullhostname)) == -1) |
if (gethostname(fullhostname, sizeof(fullhostname)) == -1) |