From a9cad0b9cf1a77546fc6a4e43ab5ef79a0e7cbc9 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 15 Jun 2004 22:17:08 +0000 Subject: [PATCH] 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 --- licence.c | 6 +++--- rdesktop.c | 26 +++++++++++++------------- rdpdr.c | 4 ++-- secure.c | 10 +++++----- tcp.c | 6 +++--- xkeymap.c | 6 +++--- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/licence.c b/licence.c index bf73f0f..b521ebb 100644 --- a/licence.c +++ b/licence.c @@ -27,7 +27,7 @@ #endif extern char g_username[16]; -extern char hostname[16]; +extern char g_hostname[16]; static uint8 g_licence_key[16]; static uint8 g_licence_sign_key[16]; @@ -56,7 +56,7 @@ static void licence_generate_hwid(uint8 * hwid) { 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 */ @@ -174,7 +174,7 @@ licence_process_demand(STREAM s) 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 */ diff --git a/rdesktop.c b/rdesktop.c index 0da09b9..9869e49 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -43,9 +43,9 @@ char g_title[64] = ""; char g_username[64]; -char hostname[16]; +char g_hostname[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 geometry will be fetched from @@ -53,7 +53,7 @@ int g_width = 800; /* width is special: If 0, the absolute value specifies the percent of the whole screen. */ int g_height = 600; -int tcp_port_rdp = TCP_PORT_RDP; +extern int g_tcp_port_rdp; int g_server_bpp = 8; int g_win_button_size = 0; /* If zero, disable single app mode */ BOOL g_bitmap_compression = True; @@ -305,7 +305,7 @@ parse_server_and_port(char *server) if (*server == '[' && p != NULL) { 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 */ *p = '\0'; strncpy(server, server + 1, strlen(server)); @@ -317,7 +317,7 @@ parse_server_and_port(char *server) p = strchr(server, ':'); if (p != NULL) { - tcp_port_rdp = strtol(p + 1, NULL, 10); + g_tcp_port_rdp = strtol(p + 1, NULL, 10); *p = 0; } } @@ -325,7 +325,7 @@ parse_server_and_port(char *server) p = strchr(server, ':'); if (p != NULL) { - tcp_port_rdp = strtol(p + 1, NULL, 10); + g_tcp_port_rdp = strtol(p + 1, NULL, 10); *p = 0; } #endif /* IPv6 */ @@ -416,7 +416,7 @@ main(int argc, char *argv[]) break; case 'n': - STRNCPY(hostname, optarg, sizeof(hostname)); + STRNCPY(g_hostname, optarg, sizeof(g_hostname)); break; case 'k': @@ -656,7 +656,7 @@ main(int argc, char *argv[]) STRNCPY(g_username, pw->pw_name, sizeof(g_username)); } - if (hostname[0] == 0) + if (g_hostname[0] == 0) { if (gethostname(fullhostname, sizeof(fullhostname)) == -1) { @@ -668,7 +668,7 @@ main(int argc, char *argv[]) if (p != NULL) *p = 0; - STRNCPY(hostname, fullhostname, sizeof(hostname)); + STRNCPY(g_hostname, fullhostname, sizeof(g_hostname)); } if (prompt_password && read_password(password, sizeof(password))) @@ -1056,8 +1056,8 @@ load_licence(unsigned char **data) if (home == NULL) return -1; - path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); - sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); + path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + sizeof("/.rdesktop/licence.")); + sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname); fd = open(path, O_RDONLY); if (fd == -1) @@ -1083,7 +1083,7 @@ save_licence(unsigned char *data, int length) if (home == NULL) 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); 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 */ - sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); + sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname); tmppath = (char *) xmalloc(strlen(path) + sizeof(".new")); strcpy(tmppath, path); strcat(tmppath, ".new"); diff --git a/rdpdr.c b/rdpdr.c index 5efa08b..ed9f94a 100644 --- a/rdpdr.c +++ b/rdpdr.c @@ -55,7 +55,7 @@ #define IRP_MN_QUERY_DIRECTORY 0x01 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 -extern char hostname[16]; +extern char g_hostname[16]; extern DEVICE_FNS serial_fns; extern DEVICE_FNS printer_fns; extern DEVICE_FNS parallel_fns; @@ -205,7 +205,7 @@ rdpdr_send_name(void) if (NULL == g_rdpdr_clientname) { - g_rdpdr_clientname = hostname; + g_rdpdr_clientname = g_hostname; } hostlen = (strlen(g_rdpdr_clientname) + 1) * 2; diff --git a/secure.c b/secure.c index d354cfb..730c44d 100644 --- a/secure.c +++ b/secure.c @@ -33,10 +33,10 @@ #include "crypto/bn.h" #endif -extern char hostname[16]; +extern char g_hostname[16]; extern int g_width; extern int g_height; -extern int keylayout; +extern int g_keylayout; extern BOOL g_encryption; extern BOOL g_licence_issued; extern BOOL g_use_rdp5; @@ -410,7 +410,7 @@ sec_establish_key(void) static void sec_out_mcs_data(STREAM s) { - int hostlen = 2 * strlen(hostname); + int hostlen = 2 * strlen(g_hostname); int length = 158 + 76 + 12 + 4; unsigned int i; @@ -446,11 +446,11 @@ sec_out_mcs_data(STREAM s) out_uint16_le(s, g_height); out_uint16_le(s, 0xca01); 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 :-) */ /* 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_uint32_le(s, 4); diff --git a/tcp.c b/tcp.c index bc877d5..a8db992 100644 --- a/tcp.c +++ b/tcp.c @@ -35,7 +35,7 @@ static int sock; static struct stream in; static struct stream out; -extern int tcp_port_rdp; +int g_tcp_port_rdp = TCP_PORT_RDP; /* Initialise TCP transport data packet */ STREAM @@ -142,7 +142,7 @@ tcp_connect(char *server) struct addrinfo hints, *res, *ressave; 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)); hints.ai_family = AF_UNSPEC; @@ -200,7 +200,7 @@ tcp_connect(char *server) } 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) { diff --git a/xkeymap.c b/xkeymap.c index 31acc0a..3c0a9fe 100644 --- a/xkeymap.c +++ b/xkeymap.c @@ -40,7 +40,7 @@ extern Display *g_display; extern Window g_wnd; extern char keymapname[16]; -extern int keylayout; +extern int g_keylayout; extern int g_win_button_size; extern BOOL g_enable_compose; extern BOOL g_use_rdp5; @@ -137,8 +137,8 @@ xkeymap_read(char *mapname) /* map */ if (strncmp(line, "map ", 4) == 0) { - keylayout = strtol(line + 4, NULL, 16); - DEBUG_KBD(("Keylayout 0x%x\n", keylayout)); + g_keylayout = strtol(line + 4, NULL, 16); + DEBUG_KBD(("Keylayout 0x%x\n", g_keylayout)); continue; }