/[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 474 by matthewc, Tue Sep 30 09:11:08 2003 UTC revision 567 by matthewc, Wed Jan 21 11:08:39 2004 UTC
# Line 1  Line 1 
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-2004
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
# Line 40  Line 40 
40  #include "crypto/md5.h"  #include "crypto/md5.h"
41  #endif  #endif
42    
43  char g_title[32] = "";  char g_title[64] = "";
44  char g_username[16];  char g_username[64];
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 */
48  int g_width = 800;              /* If width or height are reset to zero, the geometry will  
49                                     be fetched from _NET_WORKAREA */  int g_width = 800;              /* width is special: If 0, the
50                                       geometry will be fetched from
51                                       _NET_WORKAREA. If negative,
52                                       absolute value specifies the
53                                       percent of the whole screen. */
54  int g_height = 600;  int g_height = 600;
55  int tcp_port_rdp = TCP_PORT_RDP;  int tcp_port_rdp = TCP_PORT_RDP;
56  int g_server_bpp = 8;  int g_server_bpp = 8;
# Line 61  BOOL g_fullscreen = False; Line 65  BOOL g_fullscreen = False;
65  BOOL g_grab_keyboard = True;  BOOL g_grab_keyboard = True;
66  BOOL g_hide_decorations = False;  BOOL g_hide_decorations = False;
67  BOOL g_use_rdp5 = True;  BOOL g_use_rdp5 = True;
68    BOOL g_console_session = False;
69    BOOL g_numlock_sync = False;
70  extern BOOL g_owncolmap;  extern BOOL g_owncolmap;
71    
72    #ifdef WITH_RDPSND
73    BOOL g_rdpsnd = False;
74    #endif
75    
76  #ifdef RDP2VNC  #ifdef RDP2VNC
77  extern int rfb_port;  extern int rfb_port;
78  extern int defer_time;  extern int defer_time;
# Line 86  usage(char *program) Line 96  usage(char *program)
96          fprintf(stderr, "   -u: user name\n");          fprintf(stderr, "   -u: user name\n");
97          fprintf(stderr, "   -d: domain\n");          fprintf(stderr, "   -d: domain\n");
98          fprintf(stderr, "   -s: shell\n");          fprintf(stderr, "   -s: shell\n");
         fprintf(stderr, "   -S: caption button size (single application mode)\n");  
99          fprintf(stderr, "   -c: working directory\n");          fprintf(stderr, "   -c: working directory\n");
100          fprintf(stderr, "   -p: password (- to prompt)\n");          fprintf(stderr, "   -p: password (- to prompt)\n");
101          fprintf(stderr, "   -n: client hostname\n");          fprintf(stderr, "   -n: client hostname\n");
102          fprintf(stderr, "   -k: keyboard layout on terminal server (us,sv,gr,etc.)\n");          fprintf(stderr, "   -k: keyboard layout on server (en-us, de, sv, etc.)\n");
103          fprintf(stderr, "   -g: desktop geometry (WxH)\n");          fprintf(stderr, "   -g: desktop geometry (WxH)\n");
104          fprintf(stderr, "   -f: full-screen mode\n");          fprintf(stderr, "   -f: full-screen mode\n");
105          fprintf(stderr, "   -b: force bitmap updates\n");          fprintf(stderr, "   -b: force bitmap updates\n");
# Line 98  usage(char *program) Line 107  usage(char *program)
107          fprintf(stderr, "   -E: disable encryption from client to server\n");          fprintf(stderr, "   -E: disable encryption from client to server\n");
108          fprintf(stderr, "   -m: do not send motion events\n");          fprintf(stderr, "   -m: do not send motion events\n");
109          fprintf(stderr, "   -C: use private colour map\n");          fprintf(stderr, "   -C: use private colour map\n");
110            fprintf(stderr, "   -D: hide window manager decorations\n");
111          fprintf(stderr, "   -K: keep window manager key bindings\n");          fprintf(stderr, "   -K: keep window manager key bindings\n");
112            fprintf(stderr, "   -S: caption button size (single application mode)\n");
113          fprintf(stderr, "   -T: window title\n");          fprintf(stderr, "   -T: window title\n");
114          fprintf(stderr, "   -D: hide window manager decorations\n");          fprintf(stderr, "   -N: enable numlock synchronisation\n");
115          fprintf(stderr, "   -a: server bpp\n");          fprintf(stderr, "   -a: connection colour depth\n");
116          fprintf(stderr, "   -4: Use RDP version 4\n");          fprintf(stderr, "   -r: enable specified device redirection (currently: sound)\n");
117          fprintf(stderr, "   -5: Use RDP version 5 (default)\n");          fprintf(stderr, "   -0: attach to console\n");
118            fprintf(stderr, "   -4: use RDP version 4\n");
119            fprintf(stderr, "   -5: use RDP version 5 (default)\n");
120  }  }
121    
122  static BOOL  static BOOL
# Line 197  main(int argc, char *argv[]) Line 210  main(int argc, char *argv[])
210          char server[64];          char server[64];
211          char fullhostname[64];          char fullhostname[64];
212          char domain[16];          char domain[16];
213          char password[16];          char password[64];
214          char shell[128];          char shell[128];
215          char directory[32];          char directory[32];
216          BOOL prompt_password, rdp_retval = False;          BOOL prompt_password, rdp_retval = False;
# Line 218  main(int argc, char *argv[]) Line 231  main(int argc, char *argv[])
231  #define VNCOPT  #define VNCOPT
232  #endif  #endif
233    
234          while ((c = getopt(argc, argv, VNCOPT "u:d:s:S:c:p:n:k:g:a:fbeEmCKT:Dh?54")) != -1)          while ((c = getopt(argc, argv, VNCOPT "u:d:s:c:p:n:k:g:fbeEmCDKS:T:Na:r:045h?")) != -1)
235          {          {
236                  switch (c)                  switch (c)
237                  {                  {
# Line 249  main(int argc, char *argv[]) Line 262  main(int argc, char *argv[])
262                                  STRNCPY(shell, optarg, sizeof(shell));                                  STRNCPY(shell, optarg, sizeof(shell));
263                                  break;                                  break;
264    
                         case 'S':  
                                 if (!strcmp(optarg, "standard"))  
                                 {  
                                         g_win_button_size = 18;  
                                         break;  
                                 }  
   
                                 g_win_button_size = strtol(optarg, &p, 10);  
   
                                 if (*p)  
                                 {  
                                         error("invalid button size\n");  
                                         return 1;  
                                 }  
   
                                 break;  
   
265                          case 'c':                          case 'c':
266                                  STRNCPY(directory, optarg, sizeof(directory));                                  STRNCPY(directory, optarg, sizeof(directory));
267                                  break;                                  break;
# Line 295  main(int argc, char *argv[]) Line 291  main(int argc, char *argv[])
291                                  break;                                  break;
292    
293                          case 'g':                          case 'g':
294                                    g_fullscreen = False;
295                                  if (!strcmp(optarg, "workarea"))                                  if (!strcmp(optarg, "workarea"))
296                                  {                                  {
297                                          g_width = g_height = 0;                                          g_width = g_height = 0;
# Line 302  main(int argc, char *argv[]) Line 299  main(int argc, char *argv[])
299                                  }                                  }
300    
301                                  g_width = strtol(optarg, &p, 10);                                  g_width = strtol(optarg, &p, 10);
302                                    if (g_width <= 0)
303                                    {
304                                            error("invalid geometry\n");
305                                            return 1;
306                                    }
307    
308                                  if (*p == 'x')                                  if (*p == 'x')
309                                          g_height = strtol(p + 1, NULL, 10);                                          g_height = strtol(p + 1, NULL, 10);
310    
311                                  if ((g_width == 0) || (g_height == 0))                                  if (g_height <= 0)
312                                  {                                  {
313                                          error("invalid geometry\n");                                          error("invalid geometry\n");
314                                          return 1;                                          return 1;
315                                  }                                  }
316    
317                                    if (*p == '%')
318                                            g_width = -g_width;
319    
320                                  break;                                  break;
321    
322                          case 'f':                          case 'f':
# Line 334  main(int argc, char *argv[]) Line 341  main(int argc, char *argv[])
341                                  g_owncolmap = True;                                  g_owncolmap = True;
342                                  break;                                  break;
343    
344                            case 'D':
345                                    g_hide_decorations = True;
346                                    break;
347    
348                          case 'K':                          case 'K':
349                                  g_grab_keyboard = False;                                  g_grab_keyboard = False;
350                                  break;                                  break;
351    
352                            case 'S':
353                                    if (!strcmp(optarg, "standard"))
354                                    {
355                                            g_win_button_size = 18;
356                                            break;
357                                    }
358    
359                                    g_win_button_size = strtol(optarg, &p, 10);
360    
361                                    if (*p)
362                                    {
363                                            error("invalid button size\n");
364                                            return 1;
365                                    }
366    
367                                    break;
368    
369                          case 'T':                          case 'T':
370                                  STRNCPY(g_title, optarg, sizeof(g_title));                                  STRNCPY(g_title, optarg, sizeof(g_title));
371                                  break;                                  break;
372    
373                          case 'D':                          case 'N':
374                                  g_hide_decorations = True;                                  g_numlock_sync = True;
375                                  break;                                  break;
376    
377                          case 'a':                          case 'a':
# Line 356  main(int argc, char *argv[]) Line 384  main(int argc, char *argv[])
384                                  }                                  }
385                                  break;                                  break;
386    
387                            case 'r':
388                                    if (!strcmp(optarg, "sound"))
389    #ifdef WITH_RDPSND
390                                            g_rdpsnd = True;
391    #else
392                                            warning("Not compiled with sound support");
393    #endif
394                                    break;
395    
396                            case '0':
397                                    g_console_session = True;
398                                    break;
399    
400                          case '4':                          case '4':
401                                  g_use_rdp5 = False;                                  g_use_rdp5 = False;
402                                  break;                                  break;
# Line 426  main(int argc, char *argv[]) Line 467  main(int argc, char *argv[])
467                  return 1;                  return 1;
468    
469  #ifdef WITH_RDPSND  #ifdef WITH_RDPSND
470          rdpsnd_init();          if (g_rdpsnd)
471                    rdpsnd_init();
472  #endif  #endif
473          /* rdpdr_init(); */          /* rdpdr_init(); */
474    

Legend:
Removed from v.474  
changed lines
  Added in v.567

  ViewVC Help
Powered by ViewVC 1.1.26