/[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 297 by matthewc, Tue Jan 28 12:27:28 2003 UTC revision 329 by astrand, Tue Feb 18 13:07:29 2003 UTC
# Line 1  Line 1 
1  /*  /*
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-2002     Copyright (C) Matthew Chapman 1999-2003
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 21  Line 21 
21  #include <stdarg.h>             /* va_list va_start va_end */  #include <stdarg.h>             /* va_list va_start va_end */
22  #include <unistd.h>             /* read close getuid getgid getpid getppid gethostname */  #include <unistd.h>             /* read close getuid getgid getpid getppid gethostname */
23  #include <fcntl.h>              /* open */  #include <fcntl.h>              /* open */
 #include <errno.h>              /* save licence uses it. */  
24  #include <pwd.h>                /* getpwuid */  #include <pwd.h>                /* getpwuid */
25  #include <termios.h>            /* tcgetattr tcsetattr */  #include <termios.h>            /* tcgetattr tcsetattr */
26  #include <sys/stat.h>           /* stat */  #include <sys/stat.h>           /* stat */
27  #include <sys/time.h>           /* gettimeofday */  #include <sys/time.h>           /* gettimeofday */
28  #include <sys/times.h>          /* times */  #include <sys/times.h>          /* times */
29    #include <errno.h>
30  #include "rdesktop.h"  #include "rdesktop.h"
31    
32  #ifdef EGD_SOCKET  #ifdef EGD_SOCKET
# Line 45  char username[16]; Line 45  char 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 */
48  int width = 800;                /* If width or height are reset to zero, the geometry will  int width = 800;                /* If width or height are reset to zero, the geometry will
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;
53    int win_button_size = 0;        /* If zero, disable single app mode */
54  BOOL bitmap_compression = True;  BOOL bitmap_compression = True;
55  BOOL sendmotion = True;  BOOL sendmotion = True;
56  BOOL orders = True;  BOOL orders = True;
# Line 64  static void Line 66  static void
66  usage(char *program)  usage(char *program)
67  {  {
68          fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n");          fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n");
69          fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2002 Matt Chapman.\n");          fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2003 Matt Chapman.\n");
70          fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");          fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");
71    
72          fprintf(stderr, "Usage: %s [options] server[:port]\n", program);          fprintf(stderr, "Usage: %s [options] server[:port]\n", program);
73          fprintf(stderr, "   -u: user name\n");          fprintf(stderr, "   -u: user name\n");
74          fprintf(stderr, "   -d: domain\n");          fprintf(stderr, "   -d: domain\n");
75          fprintf(stderr, "   -s: shell\n");          fprintf(stderr, "   -s: shell\n");
76            fprintf(stderr, "   -S: caption button size (single application mode)\n");
77          fprintf(stderr, "   -c: working directory\n");          fprintf(stderr, "   -c: working directory\n");
78          fprintf(stderr, "   -p: password (- to prompt)\n");          fprintf(stderr, "   -p: password (- to prompt)\n");
79          fprintf(stderr, "   -n: client hostname\n");          fprintf(stderr, "   -n: client hostname\n");
# Line 84  usage(char *program) Line 87  usage(char *program)
87          fprintf(stderr, "   -K: keep window manager key bindings\n");          fprintf(stderr, "   -K: keep window manager key bindings\n");
88          fprintf(stderr, "   -T: window title\n");          fprintf(stderr, "   -T: window title\n");
89          fprintf(stderr, "   -D: hide window manager decorations\n");          fprintf(stderr, "   -D: hide window manager decorations\n");
90            fprintf(stderr, "   -a: server bpp\n");
91  }  }
92    
93  static BOOL  static BOOL
# Line 144  main(int argc, char *argv[]) Line 148  main(int argc, char *argv[])
148          domain[0] = password[0] = shell[0] = directory[0] = 0;          domain[0] = password[0] = shell[0] = directory[0] = 0;
149          strcpy(keymapname, "en-us");          strcpy(keymapname, "en-us");
150    
151          while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemCKT:Dh?")) != -1)          while ((c = getopt(argc, argv, "u:d:s:S:c:p:n:k:g:a:fbemCKT:Dh?")) != -1)
152          {          {
153                  switch (c)                  switch (c)
154                  {                  {
# Line 161  main(int argc, char *argv[]) Line 165  main(int argc, char *argv[])
165                                  STRNCPY(shell, optarg, sizeof(shell));                                  STRNCPY(shell, optarg, sizeof(shell));
166                                  break;                                  break;
167    
168                            case 'S':
169                                    if (!strcmp(optarg, "standard"))
170                                    {
171                                            win_button_size = 18;
172                                            break;
173                                    }
174    
175                                    win_button_size = strtol(optarg, &p, 10);
176    
177                                    if (*p)
178                                    {
179                                            error("invalid button size\n");
180                                            return 1;
181                                    }
182    
183                                    break;
184    
185                          case 'c':                          case 'c':
186                                  STRNCPY(directory, optarg, sizeof(directory));                                  STRNCPY(directory, optarg, sizeof(directory));
187                                  break;                                  break;
# Line 239  main(int argc, char *argv[]) Line 260  main(int argc, char *argv[])
260                                  hide_decorations = True;                                  hide_decorations = True;
261                                  break;                                  break;
262    
263                            case 'a':
264                                    server_bpp = strtol(optarg, NULL, 10);
265                                    if (server_bpp != 8 && server_bpp != 16 && server_bpp != 15
266                                        && server_bpp != 24)
267                                    {
268                                            error("invalid server bpp\n");
269                                            return 1;
270                                    }
271                                    break;
272    
273                          case 'h':                          case 'h':
274                          case '?':                          case '?':
275                          default:                          default:
# Line 503  hexdump(unsigned char *p, unsigned int l Line 534  hexdump(unsigned char *p, unsigned int l
534          }          }
535  }  }
536    
537  #ifdef SAVE_LICENCE  
538  int  int
539  load_licence(unsigned char **data)  load_licence(unsigned char **data)
540  {  {
# Line 561  save_licence(unsigned char *data, int le Line 592  save_licence(unsigned char *data, int le
592                  if ((s_ptr->p) + 4 > data + length)                  if ((s_ptr->p) + 4 > data + length)
593                  {                  {
594                          printf("Error in parsing licence key.\n");                          printf("Error in parsing licence key.\n");
595                          printf("Strings %d end value %x > supplied length (%x)\n",                          printf("Strings %d end value %x > supplied length (%x)\n", i,
596                                 i, s_ptr->p, data + length);                                 (unsigned int) s_ptr->p, (unsigned int) data + length);
597                          return;                          return;
598                  }                  }
599          }          }
# Line 570  save_licence(unsigned char *data, int le Line 601  save_licence(unsigned char *data, int le
601          if (s_ptr->p + len > data + length)          if (s_ptr->p + len > data + length)
602          {          {
603                  printf("Error in parsing licence key.\n");                  printf("Error in parsing licence key.\n");
604                  printf("End of licence %x > supplied length (%x)\n", s_ptr->p + len, data + length);                  printf("End of licence %x > supplied length (%x)\n",
605                           (unsigned int) s_ptr->p + len, (unsigned int) data + length);
606                  return;                  return;
607          }          }
608    
# Line 606  save_licence(unsigned char *data, int le Line 638  save_licence(unsigned char *data, int le
638          fnamewrk = xmalloc(strlen(fname) + 12);          fnamewrk = xmalloc(strlen(fname) + 12);
639          for (y = 0;; y++)          for (y = 0;; y++)
640          {          {
641                  sprintf(fnamewrk, "%s.%lu", fname, y);                  sprintf(fnamewrk, "%s.%lu", fname, (long unsigned int) y);
642                  fnwrkfd = open(fnamewrk, O_WRONLY | O_CREAT | O_EXCL, 0600);                  fnwrkfd = open(fnamewrk, O_WRONLY | O_CREAT | O_EXCL, 0600);
643                  if (fnwrkfd == -1)                  if (fnwrkfd == -1)
644                  {                  {
# Line 659  save_licence(unsigned char *data, int le Line 691  save_licence(unsigned char *data, int le
691          }          }
692    
693  }  }
 #endif  

Legend:
Removed from v.297  
changed lines
  Added in v.329

  ViewVC Help
Powered by ViewVC 1.1.26