proceed more global vars with g_

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@709 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Jay Sorg 2004-06-15 22:17:08 +00:00
parent d33f94f744
commit a9cad0b9cf
6 changed files with 29 additions and 29 deletions

View File

@ -27,7 +27,7 @@
#endif #endif
extern char g_username[16]; extern char g_username[16];
extern char hostname[16]; extern char g_hostname[16];
static uint8 g_licence_key[16]; static uint8 g_licence_key[16];
static uint8 g_licence_sign_key[16]; static uint8 g_licence_sign_key[16];
@ -56,7 +56,7 @@ static void
licence_generate_hwid(uint8 * hwid) licence_generate_hwid(uint8 * hwid)
{ {
buf_out_uint32(hwid, 2); buf_out_uint32(hwid, 2);
strncpy((char *) (hwid + 4), hostname, LICENCE_HWID_SIZE - 4); strncpy((char *) (hwid + 4), g_hostname, LICENCE_HWID_SIZE - 4);
} }
/* Present an existing licence to the server */ /* Present an existing licence to the server */
@ -174,7 +174,7 @@ licence_process_demand(STREAM s)
return; return;
} }
licence_send_request(null_data, null_data, g_username, hostname); licence_send_request(null_data, null_data, g_username, g_hostname);
} }
/* Send an authentication response packet */ /* Send an authentication response packet */

View File

@ -43,9 +43,9 @@
char g_title[64] = ""; char g_title[64] = "";
char g_username[64]; char g_username[64];
char hostname[16]; char g_hostname[16];
char keymapname[16]; char keymapname[16];
int keylayout = 0x409; /* Defaults to US keyboard layout */ int g_keylayout = 0x409; /* Defaults to US keyboard layout */
int g_width = 800; /* width is special: If 0, the int g_width = 800; /* width is special: If 0, the
geometry will be fetched from geometry will be fetched from
@ -53,7 +53,7 @@ int g_width = 800; /* width is special: If 0, the
absolute value specifies the absolute value specifies the
percent of the whole screen. */ percent of the whole screen. */
int g_height = 600; int g_height = 600;
int tcp_port_rdp = TCP_PORT_RDP; extern int g_tcp_port_rdp;
int g_server_bpp = 8; int g_server_bpp = 8;
int g_win_button_size = 0; /* If zero, disable single app mode */ int g_win_button_size = 0; /* If zero, disable single app mode */
BOOL g_bitmap_compression = True; BOOL g_bitmap_compression = True;
@ -305,7 +305,7 @@ parse_server_and_port(char *server)
if (*server == '[' && p != NULL) if (*server == '[' && p != NULL)
{ {
if (*(p + 1) == ':' && *(p + 2) != '\0') if (*(p + 1) == ':' && *(p + 2) != '\0')
tcp_port_rdp = strtol(p + 2, NULL, 10); g_tcp_port_rdp = strtol(p + 2, NULL, 10);
/* remove the port number and brackets from the address */ /* remove the port number and brackets from the address */
*p = '\0'; *p = '\0';
strncpy(server, server + 1, strlen(server)); strncpy(server, server + 1, strlen(server));
@ -317,7 +317,7 @@ parse_server_and_port(char *server)
p = strchr(server, ':'); p = strchr(server, ':');
if (p != NULL) if (p != NULL)
{ {
tcp_port_rdp = strtol(p + 1, NULL, 10); g_tcp_port_rdp = strtol(p + 1, NULL, 10);
*p = 0; *p = 0;
} }
} }
@ -325,7 +325,7 @@ parse_server_and_port(char *server)
p = strchr(server, ':'); p = strchr(server, ':');
if (p != NULL) if (p != NULL)
{ {
tcp_port_rdp = strtol(p + 1, NULL, 10); g_tcp_port_rdp = strtol(p + 1, NULL, 10);
*p = 0; *p = 0;
} }
#endif /* IPv6 */ #endif /* IPv6 */
@ -416,7 +416,7 @@ main(int argc, char *argv[])
break; break;
case 'n': case 'n':
STRNCPY(hostname, optarg, sizeof(hostname)); STRNCPY(g_hostname, optarg, sizeof(g_hostname));
break; break;
case 'k': case 'k':
@ -656,7 +656,7 @@ main(int argc, char *argv[])
STRNCPY(g_username, pw->pw_name, sizeof(g_username)); STRNCPY(g_username, pw->pw_name, sizeof(g_username));
} }
if (hostname[0] == 0) if (g_hostname[0] == 0)
{ {
if (gethostname(fullhostname, sizeof(fullhostname)) == -1) if (gethostname(fullhostname, sizeof(fullhostname)) == -1)
{ {
@ -668,7 +668,7 @@ main(int argc, char *argv[])
if (p != NULL) if (p != NULL)
*p = 0; *p = 0;
STRNCPY(hostname, fullhostname, sizeof(hostname)); STRNCPY(g_hostname, fullhostname, sizeof(g_hostname));
} }
if (prompt_password && read_password(password, sizeof(password))) if (prompt_password && read_password(password, sizeof(password)))
@ -1056,8 +1056,8 @@ load_licence(unsigned char **data)
if (home == NULL) if (home == NULL)
return -1; return -1;
path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + sizeof("/.rdesktop/licence."));
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname);
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
if (fd == -1) if (fd == -1)
@ -1083,7 +1083,7 @@ save_licence(unsigned char *data, int length)
if (home == NULL) if (home == NULL)
return; return;
path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + sizeof("/.rdesktop/licence."));
sprintf(path, "%s/.rdesktop", home); sprintf(path, "%s/.rdesktop", home);
if ((mkdir(path, 0700) == -1) && errno != EEXIST) if ((mkdir(path, 0700) == -1) && errno != EEXIST)
@ -1094,7 +1094,7 @@ save_licence(unsigned char *data, int length)
/* write licence to licence.hostname.new, then atomically rename to licence.hostname */ /* write licence to licence.hostname.new, then atomically rename to licence.hostname */
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname);
tmppath = (char *) xmalloc(strlen(path) + sizeof(".new")); tmppath = (char *) xmalloc(strlen(path) + sizeof(".new"));
strcpy(tmppath, path); strcpy(tmppath, path);
strcat(tmppath, ".new"); strcat(tmppath, ".new");

View File

@ -55,7 +55,7 @@
#define IRP_MN_QUERY_DIRECTORY 0x01 #define IRP_MN_QUERY_DIRECTORY 0x01
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
extern char hostname[16]; extern char g_hostname[16];
extern DEVICE_FNS serial_fns; extern DEVICE_FNS serial_fns;
extern DEVICE_FNS printer_fns; extern DEVICE_FNS printer_fns;
extern DEVICE_FNS parallel_fns; extern DEVICE_FNS parallel_fns;
@ -205,7 +205,7 @@ rdpdr_send_name(void)
if (NULL == g_rdpdr_clientname) if (NULL == g_rdpdr_clientname)
{ {
g_rdpdr_clientname = hostname; g_rdpdr_clientname = g_hostname;
} }
hostlen = (strlen(g_rdpdr_clientname) + 1) * 2; hostlen = (strlen(g_rdpdr_clientname) + 1) * 2;

View File

@ -33,10 +33,10 @@
#include "crypto/bn.h" #include "crypto/bn.h"
#endif #endif
extern char hostname[16]; extern char g_hostname[16];
extern int g_width; extern int g_width;
extern int g_height; extern int g_height;
extern int keylayout; extern int g_keylayout;
extern BOOL g_encryption; extern BOOL g_encryption;
extern BOOL g_licence_issued; extern BOOL g_licence_issued;
extern BOOL g_use_rdp5; extern BOOL g_use_rdp5;
@ -410,7 +410,7 @@ sec_establish_key(void)
static void static void
sec_out_mcs_data(STREAM s) sec_out_mcs_data(STREAM s)
{ {
int hostlen = 2 * strlen(hostname); int hostlen = 2 * strlen(g_hostname);
int length = 158 + 76 + 12 + 4; int length = 158 + 76 + 12 + 4;
unsigned int i; unsigned int i;
@ -446,11 +446,11 @@ sec_out_mcs_data(STREAM s)
out_uint16_le(s, g_height); out_uint16_le(s, g_height);
out_uint16_le(s, 0xca01); out_uint16_le(s, 0xca01);
out_uint16_le(s, 0xaa03); out_uint16_le(s, 0xaa03);
out_uint32_le(s, keylayout); out_uint32_le(s, g_keylayout);
out_uint32_le(s, 2600); /* Client build. We are now 2600 compatible :-) */ out_uint32_le(s, 2600); /* Client build. We are now 2600 compatible :-) */
/* Unicode name of client, padded to 32 bytes */ /* Unicode name of client, padded to 32 bytes */
rdp_out_unistr(s, hostname, hostlen); rdp_out_unistr(s, g_hostname, hostlen);
out_uint8s(s, 30 - hostlen); out_uint8s(s, 30 - hostlen);
out_uint32_le(s, 4); out_uint32_le(s, 4);

6
tcp.c
View File

@ -35,7 +35,7 @@
static int sock; static int sock;
static struct stream in; static struct stream in;
static struct stream out; static struct stream out;
extern int tcp_port_rdp; int g_tcp_port_rdp = TCP_PORT_RDP;
/* Initialise TCP transport data packet */ /* Initialise TCP transport data packet */
STREAM STREAM
@ -142,7 +142,7 @@ tcp_connect(char *server)
struct addrinfo hints, *res, *ressave; struct addrinfo hints, *res, *ressave;
char tcp_port_rdp_s[10]; char tcp_port_rdp_s[10];
snprintf(tcp_port_rdp_s, 10, "%d", tcp_port_rdp); snprintf(tcp_port_rdp_s, 10, "%d", g_tcp_port_rdp);
memset(&hints, 0, sizeof(struct addrinfo)); memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;
@ -200,7 +200,7 @@ tcp_connect(char *server)
} }
servaddr.sin_family = AF_INET; servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(tcp_port_rdp); servaddr.sin_port = htons(g_tcp_port_rdp);
if (connect(sock, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) < 0) if (connect(sock, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) < 0)
{ {

View File

@ -40,7 +40,7 @@
extern Display *g_display; extern Display *g_display;
extern Window g_wnd; extern Window g_wnd;
extern char keymapname[16]; extern char keymapname[16];
extern int keylayout; extern int g_keylayout;
extern int g_win_button_size; extern int g_win_button_size;
extern BOOL g_enable_compose; extern BOOL g_enable_compose;
extern BOOL g_use_rdp5; extern BOOL g_use_rdp5;
@ -137,8 +137,8 @@ xkeymap_read(char *mapname)
/* map */ /* map */
if (strncmp(line, "map ", 4) == 0) if (strncmp(line, "map ", 4) == 0)
{ {
keylayout = strtol(line + 4, NULL, 16); g_keylayout = strtol(line + 4, NULL, 16);
DEBUG_KBD(("Keylayout 0x%x\n", keylayout)); DEBUG_KBD(("Keylayout 0x%x\n", g_keylayout));
continue; continue;
} }