/[rdesktop]/jpeg/rdesktop/trunk/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 /jpeg/rdesktop/trunk/rdesktop.c

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

revision 1053 by astrand, Thu Mar 2 15:22:25 2006 UTC revision 1309 by stargo, Wed Nov 1 20:52:01 2006 UTC
# Line 69  int g_pos = 0;                 /* 0 position unspecifi Line 69  int g_pos = 0;                 /* 0 position unspecifi
69                                     2 xpos neg,                                     2 xpos neg,
70                                     4 ypos neg  */                                     4 ypos neg  */
71  extern int g_tcp_port_rdp;  extern int g_tcp_port_rdp;
72  int g_server_depth = 8;  int g_server_depth = -1;
73  int g_win_button_size = 0;      /* If zero, disable single app mode */  int g_win_button_size = 0;      /* If zero, disable single app mode */
74  BOOL g_bitmap_compression = True;  BOOL g_bitmap_compression = True;
75  BOOL g_sendmotion = True;  BOOL g_sendmotion = True;
# Line 84  BOOL g_fullscreen = False; Line 84  BOOL g_fullscreen = False;
84  BOOL g_grab_keyboard = True;  BOOL g_grab_keyboard = True;
85  BOOL g_hide_decorations = False;  BOOL g_hide_decorations = False;
86  BOOL g_use_rdp5 = True;  BOOL g_use_rdp5 = True;
87    BOOL g_rdpclip = True;
88  BOOL g_console_session = False;  BOOL g_console_session = False;
89  BOOL g_numlock_sync = False;  BOOL g_numlock_sync = False;
90  BOOL lspci_enabled = False;  BOOL lspci_enabled = False;
91  BOOL g_owncolmap = False;  BOOL g_owncolmap = False;
92  BOOL g_ownbackstore = True;     /* We can't rely on external BackingStore */  BOOL g_ownbackstore = True;     /* We can't rely on external BackingStore */
93    BOOL g_seamless_rdp = False;
94  uint32 g_embed_wnd;  uint32 g_embed_wnd;
95  uint32 g_rdp5_performanceflags =  uint32 g_rdp5_performanceflags =
96          RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS;          RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS;
# Line 146  usage(char *program) Line 148  usage(char *program)
148  #ifdef HAVE_ICONV  #ifdef HAVE_ICONV
149          fprintf(stderr, "   -L: local codepage\n");          fprintf(stderr, "   -L: local codepage\n");
150  #endif  #endif
151            fprintf(stderr, "   -A: enable SeamlessRDP mode\n");
152          fprintf(stderr, "   -B: use BackingStore of X-server (if available)\n");          fprintf(stderr, "   -B: use BackingStore of X-server (if available)\n");
153          fprintf(stderr, "   -e: disable encryption (French TS)\n");          fprintf(stderr, "   -e: disable encryption (French TS)\n");
154          fprintf(stderr, "   -E: disable encryption from client to server\n");          fprintf(stderr, "   -E: disable encryption from client to server\n");
# Line 176  usage(char *program) Line 179  usage(char *program)
179          fprintf(stderr, "         '-r printer:mydeskjet': enable printer redirection\n");          fprintf(stderr, "         '-r printer:mydeskjet': enable printer redirection\n");
180          fprintf(stderr,          fprintf(stderr,
181                  "             or      mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n");                  "             or      mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n");
182          fprintf(stderr, "         '-r sound:[local|off|remote]': enable sound redirection\n");  #ifdef WITH_RDPSND
183            fprintf(stderr,
184                    "         '-r sound:[local[:driver[:device]]|off|remote]': enable sound redirection\n");
185          fprintf(stderr, "                     remote would leave sound on server\n");          fprintf(stderr, "                     remote would leave sound on server\n");
186            fprintf(stderr, "                     available drivers for 'local':\n");
187            rdpsnd_show_help();
188    #endif
189            fprintf(stderr,
190                    "         '-r clipboard:[off|PRIMARYCLIPBOARD|CLIPBOARD]': enable clipboard\n");
191            fprintf(stderr, "                      redirection.\n");
192            fprintf(stderr,
193                    "                      'PRIMARYCLIPBOARD' looks at both PRIMARY and CLIPBOARD\n");
194            fprintf(stderr, "                      when sending data to server.\n");
195            fprintf(stderr, "                      'CLIPBOARD' looks at only CLIPBOARD.\n");
196    #ifdef WITH_SCARD
197            fprintf(stderr, "         '-r scard[:\"Scard Name\"=\"Alias Name[;Vendor Name]\"[,...]]\n");
198            fprintf(stderr, "          example: -r scard:\"eToken PRO 00 00\"=\"AKS ifdh 0\"\n");
199            fprintf(stderr,
200                    "                   \"eToken PRO 00 00\" -> Device in Linux/Unix enviroment\n");
201            fprintf(stderr,
202                    "                   \"AKS ifdh 0\"       -> Device shown in Windows enviroment \n");
203            fprintf(stderr, "          example: -r scard:\"eToken PRO 00 00\"=\"AKS ifdh 0;AKS\"\n");
204            fprintf(stderr,
205                    "                   \"eToken PRO 00 00\" -> Device in Linux/Unix enviroment\n");
206            fprintf(stderr,
207                    "                   \"AKS ifdh 0\"       -> Device shown in Windows enviroment \n");
208            fprintf(stderr,
209                    "                   \"AKS\"              -> Device vendor name                 \n");
210    #endif
211          fprintf(stderr, "   -0: attach to console\n");          fprintf(stderr, "   -0: attach to console\n");
212          fprintf(stderr, "   -4: use RDP version 4\n");          fprintf(stderr, "   -4: use RDP version 4\n");
213          fprintf(stderr, "   -5: use RDP version 5 (default)\n");          fprintf(stderr, "   -5: use RDP version 5 (default)\n");
# Line 390  main(int argc, char *argv[]) Line 420  main(int argc, char *argv[])
420          int c;          int c;
421          char *locale = NULL;          char *locale = NULL;
422          int username_option = 0;          int username_option = 0;
423            BOOL geometry_option = False;
424          int run_count = 0;      /* Session Directory support */          int run_count = 0;      /* Session Directory support */
425          BOOL continue_connect = True;   /* Session Directory support */          BOOL continue_connect = True;   /* Session Directory support */
426            char *rdpsnd_optarg = NULL;
427    
428  #ifdef HAVE_LOCALE_H  #ifdef HAVE_LOCALE_H
429          /* Set locale according to environment */          /* Set locale according to environment */
# Line 416  main(int argc, char *argv[]) Line 448  main(int argc, char *argv[])
448  #endif  #endif
449    
450          while ((c = getopt(argc, argv,          while ((c = getopt(argc, argv,
451                             VNCOPT "u:L:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1)                             VNCOPT "Au:L:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
452          {          {
453                  switch (c)                  switch (c)
454                  {                  {
# Line 434  main(int argc, char *argv[]) Line 466  main(int argc, char *argv[])
466                                  break;                                  break;
467  #endif  #endif
468    
469                            case 'A':
470                                    g_seamless_rdp = True;
471                                    break;
472    
473                          case 'u':                          case 'u':
474                                  STRNCPY(g_username, optarg, sizeof(g_username));                                  STRNCPY(g_username, optarg, sizeof(g_username));
475                                  username_option = 1;                                  username_option = 1;
# Line 484  main(int argc, char *argv[]) Line 520  main(int argc, char *argv[])
520                                  break;                                  break;
521    
522                          case 'g':                          case 'g':
523                                    geometry_option = True;
524                                  g_fullscreen = False;                                  g_fullscreen = False;
525                                  if (!strcmp(optarg, "workarea"))                                  if (!strcmp(optarg, "workarea"))
526                                  {                                  {
# Line 639  main(int argc, char *argv[]) Line 676  main(int argc, char *argv[])
676    
677                                          if (*optarg == ':')                                          if (*optarg == ':')
678                                          {                                          {
679                                                  *optarg++;                                                  optarg++;
680                                                  while ((p = next_arg(optarg, ',')))                                                  while ((p = next_arg(optarg, ',')))
681                                                  {                                                  {
682                                                          if (str_startswith(optarg, "remote"))                                                          if (str_startswith(optarg, "remote"))
# Line 647  main(int argc, char *argv[]) Line 684  main(int argc, char *argv[])
684    
685                                                          if (str_startswith(optarg, "local"))                                                          if (str_startswith(optarg, "local"))
686  #ifdef WITH_RDPSND  #ifdef WITH_RDPSND
687                                                            {
688                                                                    rdpsnd_optarg =
689                                                                            next_arg(optarg, ':');
690                                                                  g_rdpsnd = True;                                                                  g_rdpsnd = True;
691                                                            }
692    
693  #else  #else
694                                                                  warning("Not compiled with sound support\n");                                                                  warning("Not compiled with sound support\n");
695  #endif  #endif
# Line 697  main(int argc, char *argv[]) Line 739  main(int argc, char *argv[])
739                                          g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1);                                          g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1);
740                                          strcpy(g_rdpdr_clientname, optarg + 11);                                          strcpy(g_rdpdr_clientname, optarg + 11);
741                                  }                                  }
742                                    else if (str_startswith(optarg, "clipboard"))
743                                    {
744                                            optarg += 9;
745    
746                                            if (*optarg == ':')
747                                            {
748                                                    optarg++;
749    
750                                                    if (str_startswith(optarg, "off"))
751                                                            g_rdpclip = False;
752                                                    else
753                                                            cliprdr_set_mode(optarg);
754                                            }
755                                            else
756                                                    g_rdpclip = True;
757                                    }
758                                    else if (strncmp("scard", optarg, 5) == 0)
759                                    {
760    #ifdef WITH_SCARD
761                                            scard_enum_devices(&g_num_devices, optarg + 5);
762    #else
763                                            warning("Not compiled with smartcard support\n");
764    #endif
765                                    }
766                                  else                                  else
767                                  {                                  {
768                                          warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound\n");                                          warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound, clipboard, scard\n");
769                                  }                                  }
770                                  break;                                  break;
771    
# Line 732  main(int argc, char *argv[]) Line 798  main(int argc, char *argv[])
798          STRNCPY(server, argv[optind], sizeof(server));          STRNCPY(server, argv[optind], sizeof(server));
799          parse_server_and_port(server);          parse_server_and_port(server);
800    
801            if (g_seamless_rdp)
802            {
803                    if (g_win_button_size)
804                    {
805                            error("You cannot use -S and -A at the same time\n");
806                            return 1;
807                    }
808                    g_rdp5_performanceflags &= ~RDP5_NO_FULLWINDOWDRAG;
809                    if (geometry_option)
810                    {
811                            error("You cannot use -g and -A at the same time\n");
812                            return 1;
813                    }
814                    if (g_fullscreen)
815                    {
816                            error("You cannot use -f and -A at the same time\n");
817                            return 1;
818                    }
819                    if (g_hide_decorations)
820                    {
821                            error("You cannot use -D and -A at the same time\n");
822                            return 1;
823                    }
824                    if (g_embed_wnd)
825                    {
826                            error("You cannot use -X and -A at the same time\n");
827                            return 1;
828                    }
829                    if (!g_use_rdp5)
830                    {
831                            error("You cannot use -4 and -A at the same time\n");
832                            return 1;
833                    }
834                    g_width = -100;
835                    g_grab_keyboard = False;
836            }
837    
838          if (!username_option)          if (!username_option)
839          {          {
840                  pw = getpwuid(getuid());                  pw = getpwuid(getuid());
# Line 807  main(int argc, char *argv[]) Line 910  main(int argc, char *argv[])
910    
911  #ifdef WITH_RDPSND  #ifdef WITH_RDPSND
912          if (g_rdpsnd)          if (g_rdpsnd)
913                  rdpsnd_init();          {
914                    if (!rdpsnd_init(rdpsnd_optarg))
915                    {
916                            warning("Initializing sound-support failed!\n");
917                    }
918            }
919  #endif  #endif
920    
921          if (lspci_enabled)          if (lspci_enabled)
# Line 994  xmalloc(int size) Line 1102  xmalloc(int size)
1102          return mem;          return mem;
1103  }  }
1104    
1105    /* Exit on NULL pointer. Use to verify result from XGetImage etc */
1106    void
1107    exit_if_null(void *ptr)
1108    {
1109            if (ptr == NULL)
1110            {
1111                    error("unexpected null pointer. Out of memory?\n");
1112                    exit(1);
1113            }
1114    }
1115    
1116  /* strdup */  /* strdup */
1117  char *  char *
1118  xstrdup(const char *s)  xstrdup(const char *s)
# Line 1142  next_arg(char *src, char needle) Line 1261  next_arg(char *src, char needle)
1261                          while (*(mvp + 1) != (char) 0x00)                          while (*(mvp + 1) != (char) 0x00)
1262                          {                          {
1263                                  *mvp = *(mvp + 1);                                  *mvp = *(mvp + 1);
1264                                  *mvp++;                                  mvp++;
1265                          }                          }
1266                          *mvp = (char) 0x00;                          *mvp = (char) 0x00;
1267                          p = nextval;                          p = nextval;

Legend:
Removed from v.1053  
changed lines
  Added in v.1309

  ViewVC Help
Powered by ViewVC 1.1.26