/[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 33 by matty, Sat Sep 15 12:34:34 2001 UTC revision 39 by matthewc, Fri Apr 5 07:57:43 2002 UTC
# Line 23  Line 23 
23  #include <unistd.h>             /* read close getuid getgid getpid getppid gethostname */  #include <unistd.h>             /* read close getuid getgid getpid getppid gethostname */
24  #include <fcntl.h>              /* open */  #include <fcntl.h>              /* open */
25  #include <pwd.h>                /* getpwuid */  #include <pwd.h>                /* getpwuid */
26    #include <limits.h>             /* PATH_MAX */
27  #include <sys/stat.h>           /* stat */  #include <sys/stat.h>           /* stat */
28  #include <sys/time.h>           /* gettimeofday */  #include <sys/time.h>           /* gettimeofday */
29  #include <sys/times.h>          /* times */  #include <sys/times.h>          /* times */
# Line 30  Line 31 
31    
32  char username[16];  char username[16];
33  char hostname[16];  char hostname[16];
34    char keymapname[16];
35    int keylayout;
36  int width;  int width;
37  int height;  int height;
 int keylayout = 0x409;  
38  BOOL bitmap_compression = True;  BOOL bitmap_compression = True;
39  BOOL sendmotion = True;  BOOL sendmotion = True;
40  BOOL orders = True;  BOOL orders = True;
# Line 52  usage(char *program) Line 54  usage(char *program)
54          printf("   -c: working directory\n");          printf("   -c: working directory\n");
55          printf("   -p: password (autologon)\n");          printf("   -p: password (autologon)\n");
56          printf("   -n: client hostname\n");          printf("   -n: client hostname\n");
57          printf("   -k: keyboard layout (hex)\n");          printf("   -k: keyboard layout\n");
58          printf("   -g: desktop geometry (WxH)\n");          printf("   -g: desktop geometry (WxH)\n");
59          printf("   -f: full-screen mode\n");          printf("   -f: full-screen mode\n");
60          printf("   -b: force bitmap updates\n");          printf("   -b: force bitmap updates\n");
# Line 82  main(int argc, char *argv[]) Line 84  main(int argc, char *argv[])
84    
85          flags = RDP_LOGON_NORMAL;          flags = RDP_LOGON_NORMAL;
86          domain[0] = password[0] = shell[0] = directory[0] = 0;          domain[0] = password[0] = shell[0] = directory[0] = 0;
87            strcpy(keymapname, "us");
88    
89          while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemlh?")) != -1)          while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemlh?")) != -1)
90          {          {
# Line 113  main(int argc, char *argv[]) Line 116  main(int argc, char *argv[])
116                                  break;                                  break;
117    
118                          case 'k':                          case 'k':
119                                  keylayout = strtol(optarg, NULL, 16);                                  STRNCPY(keymapname, optarg, sizeof(keymapname));
                                 if (keylayout == 0)  
                                 {  
                                         error("invalid keyboard layout\n");  
                                         return 1;  
                                 }  
120                                  break;                                  break;
121    
122                          case 'g':                          case 'g':
# Line 226  main(int argc, char *argv[]) Line 224  main(int argc, char *argv[])
224                  rdp_main_loop();                  rdp_main_loop();
225                  printf("Disconnecting...\n");                  printf("Disconnecting...\n");
226                  ui_destroy_window();                  ui_destroy_window();
227                    rdp_disconnect();
228          }          }
229    
         rdp_disconnect();  
230          return 0;          return 0;
231  }  }
232    
# Line 351  hexdump(unsigned char *p, unsigned int l Line 349  hexdump(unsigned char *p, unsigned int l
349                  line += thisline;                  line += thisline;
350          }          }
351  }  }
352    
353    int
354    load_licence(unsigned char **data)
355    {
356            char path[PATH_MAX];
357            char *home;
358            struct stat st;
359            int fd;
360    
361            home = getenv("HOME");
362            if (home == NULL)
363                    return -1;
364    
365            STRNCPY(path, home, sizeof(path));
366            strncat(path, "/.rdesktop/licence", sizeof(path)-strlen(path)-1);
367    
368            fd = open(path, O_RDONLY);
369            if (fd == -1)
370                    return -1;
371    
372            if (fstat(fd, &st))
373                    return -1;
374    
375            *data = xmalloc(st.st_size);
376            return read(fd, *data, st.st_size);
377    }
378    
379    void
380    save_licence(unsigned char *data, int length)
381    {
382            char path[PATH_MAX];
383            char *home;
384            int fd;
385    
386            home = getenv("HOME");
387            if (home == NULL)
388                    return;
389    
390            STRNCPY(path, home, sizeof(path));
391            strncat(path, "/.rdesktop", sizeof(path)-strlen(path)-1);
392            mkdir(path, 0700);
393    
394            strncat(path, "/licence", sizeof(path)-strlen(path)-1);
395    
396            fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0600);
397            if (fd == -1)
398            {
399                    perror("open");
400                    return;
401            }
402    
403            write(fd, data, length);
404            close(fd);
405    }
406    

Legend:
Removed from v.33  
changed lines
  Added in v.39

  ViewVC Help
Powered by ViewVC 1.1.26