/[rdesktop]/sourceforge.net/trunk/rdesktop/rdesktop.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdesktop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 435 by astrand, Wed Jul 9 09:18:20 2003 UTC revision 444 by astrand, Sun Aug 17 07:31:36 2003 UTC
# Line 41  Line 41 
41  #endif  #endif
42    
43  char title[32] = "";  char title[32] = "";
44  char username[16];  char g_username[16];
45  char hostname[16];  char hostname[16];
46  char keymapname[16];  char keymapname[16];
47  int keylayout = 0x409;          /* Defaults to US keyboard layout */  int keylayout = 0x409;          /* Defaults to US keyboard layout */
# Line 49  int width = 800;               /* If width or height Line 49  int width = 800;               /* If width or height
49                                     be fetched from _NET_WORKAREA */                                     be fetched from _NET_WORKAREA */
50  int height = 600;  int height = 600;
51  int tcp_port_rdp = TCP_PORT_RDP;  int tcp_port_rdp = TCP_PORT_RDP;
52  int server_bpp = 8;  int g_server_bpp = 8;
53  int win_button_size = 0;        /* If zero, disable single app mode */  int win_button_size = 0;        /* If zero, disable single app mode */
54  BOOL bitmap_compression = True;  BOOL g_bitmap_compression = True;
55  BOOL sendmotion = True;  BOOL sendmotion = True;
56  BOOL orders = True;  BOOL g_orders = True;
57  BOOL encryption = True;  BOOL g_encryption = True;
58  BOOL packet_encryption = True;  BOOL packet_encryption = True;
59  BOOL desktop_save = True;  BOOL g_desktop_save = True;
60  BOOL fullscreen = False;  BOOL fullscreen = False;
61  BOOL grab_keyboard = True;  BOOL grab_keyboard = True;
62  BOOL hide_decorations = False;  BOOL hide_decorations = False;
63  BOOL use_rdp5 = False;  BOOL g_use_rdp5 = False;
64  extern BOOL owncolmap;  extern BOOL owncolmap;
65    
66  #ifdef RDP2VNC  #ifdef RDP2VNC
# Line 141  read_password(char *password, int size) Line 141  read_password(char *password, int size)
141          return ret;          return ret;
142  }  }
143    
144    static void
145    parse_server_and_port(char *server)
146    {
147            char *p;
148    #ifdef IPv6
149            int addr_colons;
150    #endif
151    
152    #ifdef IPv6
153            p = server;
154            addr_colons = 0;
155            while (*p)
156                    if (*p++ == ':')
157                            addr_colons++;
158            if (addr_colons >= 2)
159            {
160                    /* numeric IPv6 style address format - [1:2:3::4]:port */
161                    p = strchr(server, ']');
162                    if (*server == '[' && p != NULL)
163                    {
164                            if (*(p + 1) == ':' && *(p + 2) != '\0')
165                                    tcp_port_rdp = strtol(p + 2, NULL, 10);
166                            /* remove the port number and brackets from the address */
167                            *p = '\0';
168                            strncpy(server, server + 1, strlen(server));
169                    }
170            }
171            else
172            {
173                    /* dns name or IPv4 style address format - server.example.com:port or 1.2.3.4:port */
174                    p = strchr(server, ':');
175                    if (p != NULL)
176                    {
177                            tcp_port_rdp = strtol(p + 1, NULL, 10);
178                            *p = 0;
179                    }
180            }
181    #else /* no IPv6 support */
182            p = strchr(server, ':');
183            if (p != NULL)
184            {
185                    tcp_port_rdp = strtol(p + 1, NULL, 10);
186                    *p = 0;
187            }
188    #endif /* IPv6 */
189    
190    }
191    
192  /* Client program */  /* Client program */
193  int  int
194  main(int argc, char *argv[])  main(int argc, char *argv[])
# Line 188  main(int argc, char *argv[]) Line 236  main(int argc, char *argv[])
236  #endif  #endif
237    
238                          case 'u':                          case 'u':
239                                  STRNCPY(username, optarg, sizeof(username));                                  STRNCPY(g_username, optarg, sizeof(g_username));
240                                  username_option = 1;                                  username_option = 1;
241                                  break;                                  break;
242    
# Line 268  main(int argc, char *argv[]) Line 316  main(int argc, char *argv[])
316                                  break;                                  break;
317    
318                          case 'b':                          case 'b':
319                                  orders = False;                                  g_orders = False;
320                                  break;                                  break;
321    
322                          case 'e':                          case 'e':
323                                  encryption = False;                                  g_encryption = False;
324                                  break;                                  break;
325                          case 'E':                          case 'E':
326                                  packet_encryption = False;                                  packet_encryption = False;
# Line 298  main(int argc, char *argv[]) Line 346  main(int argc, char *argv[])
346                                  break;                                  break;
347    
348                          case 'a':                          case 'a':
349                                  server_bpp = strtol(optarg, NULL, 10);                                  g_server_bpp = strtol(optarg, NULL, 10);
350                                  if (server_bpp != 8 && server_bpp != 16 && server_bpp != 15                                  if (g_server_bpp != 8 && g_server_bpp != 16 && g_server_bpp != 15
351                                      && server_bpp != 24)                                      && g_server_bpp != 24)
352                                  {                                  {
353                                          error("invalid server bpp\n");                                          error("invalid server bpp\n");
354                                          return 1;                                          return 1;
# Line 308  main(int argc, char *argv[]) Line 356  main(int argc, char *argv[])
356                                  break;                                  break;
357    
358                          case '5':                          case '5':
359                                  use_rdp5 = True;                                  g_use_rdp5 = True;
360                                  break;                                  break;
361                          case 'h':                          case 'h':
362                          case '?':                          case '?':
# Line 325  main(int argc, char *argv[]) Line 373  main(int argc, char *argv[])
373          }          }
374    
375          STRNCPY(server, argv[optind], sizeof(server));          STRNCPY(server, argv[optind], sizeof(server));
376          p = strchr(server, ':');          parse_server_and_port(server);
         if (p != NULL)  
         {  
                 tcp_port_rdp = strtol(p + 1, NULL, 10);  
                 *p = 0;  
         }  
377    
378          if (!username_option)          if (!username_option)
379          {          {
# Line 341  main(int argc, char *argv[]) Line 384  main(int argc, char *argv[])
384                          return 1;                          return 1;
385                  }                  }
386    
387                  STRNCPY(username, pw->pw_name, sizeof(username));                  STRNCPY(g_username, pw->pw_name, sizeof(g_username));
388          }          }
389    
390          if (hostname[0] == 0)          if (hostname[0] == 0)
# Line 385  main(int argc, char *argv[]) Line 428  main(int argc, char *argv[])
428          /* By setting encryption to False here, we have an encrypted login          /* By setting encryption to False here, we have an encrypted login
429             packet but unencrypted transfer of other packets */             packet but unencrypted transfer of other packets */
430          if (!packet_encryption)          if (!packet_encryption)
431                  encryption = False;                  g_encryption = False;
432    
433    
434          DEBUG(("Connection successful.\n"));          DEBUG(("Connection successful.\n"));

Legend:
Removed from v.435  
changed lines
  Added in v.444

  ViewVC Help
Powered by ViewVC 1.1.26