--- sourceforge.net/trunk/rdesktop/rdesktop.c 2004/01/21 18:17:20 571 +++ sourceforge.net/trunk/rdesktop/rdesktop.c 2004/03/04 13:23:23 629 @@ -69,6 +69,7 @@ BOOL g_console_session = False; BOOL g_numlock_sync = False; extern BOOL g_owncolmap; +extern BOOL g_ownbackstore; #ifdef WITH_RDPSND BOOL g_rdpsnd = False; @@ -107,6 +108,7 @@ fprintf(stderr, " -g: desktop geometry (WxH)\n"); fprintf(stderr, " -f: full-screen mode\n"); fprintf(stderr, " -b: force bitmap updates\n"); + fprintf(stderr, " -B: use BackingStore of X-server (if available)\n"); fprintf(stderr, " -e: disable encryption (French TS)\n"); fprintf(stderr, " -E: disable encryption from client to server\n"); fprintf(stderr, " -m: do not send motion events\n"); @@ -118,15 +120,20 @@ fprintf(stderr, " -N: enable numlock syncronization\n"); fprintf(stderr, " -a: connection colour depth\n"); fprintf(stderr, " -r: enable specified device redirection (this flag can be repeated)\n"); - fprintf(stderr, " '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n"); - fprintf(stderr, " or :COM1=/dev/ttyS0:9600,0|1|2,0|2,5|6|7|8:dtr \n"); - fprintf(stderr, " '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n"); + fprintf(stderr, + " '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n"); + fprintf(stderr, " or COM1=/dev/ttyS0,COM2=/dev/ttyS1\n"); + fprintf(stderr, + " '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n"); fprintf(stderr, " or A=/mnt/floppy,D=/mnt/cdrom'\n"); - fprintf(stderr, " '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1\n"); - fprintf(stderr, " or LPT1=/dev/lp0,LPT2=/dev/lp1\n"); + fprintf(stderr, + " '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1\n"); + fprintf(stderr, " or LPT1=/dev/lp0,LPT2=/dev/lp1\n"); fprintf(stderr, " '-r printer:mydeskjet': enable printer redirection\n"); - fprintf(stderr, " or mydeskjet:\"HP Laserjet IIIP\" to enter server driver as well\n"); - fprintf(stderr, " '-r sound': enable sound redirection\n"); + fprintf(stderr, + " or mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n"); + fprintf(stderr, " '-r sound:[on|off|remote]': enable sound redirection\n"); + fprintf(stderr, " remote would leave sound on server\n"); fprintf(stderr, " -0: attach to console\n"); fprintf(stderr, " -4: use RDP version 4\n"); fprintf(stderr, " -5: use RDP version 5 (default)\n"); @@ -247,7 +254,7 @@ #define VNCOPT #endif - while ((c = getopt(argc, argv, VNCOPT "u:d:s:c:p:n:k:g:fbeEmCDKS:T:Na:r:045h?")) != -1) + while ((c = getopt(argc, argv, VNCOPT "u:d:s:c:p:n:k:g:fbBeEmCDKS:T:Na:r:045h?")) != -1) { switch (c) { @@ -343,6 +350,10 @@ g_orders = False; break; + case 'B': + g_ownbackstore = False; + break; + case 'e': g_encryption = False; break; @@ -404,11 +415,37 @@ if (strncmp("sound", optarg, 5) == 0) { + optarg += 5; + + if (*optarg == ':') + { + *optarg++; + while ((p = next_arg(optarg, ','))) + { + if (strncmp("remote", optarg, 6) == 0) + flags |= RDP_LOGON_LEAVE_AUDIO; + + if (strncmp("on", optarg, 2) == 0) +#ifdef WITH_RDPSND + g_rdpsnd = True; +#else + warning("Not compiled with sound support"); +#endif + + if (strncmp("off", optarg, 3) == 0) + g_rdpsnd = False; + + optarg = p; + } + } + else + { #ifdef WITH_RDPSND - g_rdpsnd = True; + g_rdpsnd = True; #else - warning("Not compiled with sound support"); + warning("Not compiled with sound support"); #endif + } } else if (strncmp("disk", optarg, 4) == 0) { @@ -453,7 +490,7 @@ } } - if (argc - optind < 1) + if (argc - optind != 1) { usage(argv[0]); return 1; @@ -728,7 +765,9 @@ } /* - input: src is the string we look in for needle + input: src is the string we look in for needle. + Needle may be escaped by a backslash, in + that case we ignore that particular needle. return value: returns next src pointer, for succesive executions, like in a while loop if retval is 0, then there are no more args. @@ -750,38 +789,56 @@ { char *nextval; char *p; + char *mvp = 0; - // EOS + /* EOS */ if (*src == (char) 0x00) return 0; p = src; - // skip escaped needles. - while( (nextval = strchr(p, needle) ) ) + /* skip escaped needles */ + while ((nextval = strchr(p, needle))) { - if( *(nextval-1) != '\\' ) + mvp = nextval - 1; + /* found backslashed needle */ + if (*mvp == '\\' && (mvp > src)) + { + /* move string one to the left */ + while (*(mvp + 1) != (char) 0x00) + { + *mvp = *(mvp + 1); + *mvp++; + } + *mvp = (char) 0x00; + p = nextval; + } + else + { + p = nextval + 1; break; - p = nextval +1; + } + } - // more args available + /* more args available */ if (nextval) { *nextval = (char) 0x00; return ++nextval; } - // no more args after this, jump to EOS + /* no more args after this, jump to EOS */ nextval = src + strlen(src); return nextval; } void -toupper_str(char* p) +toupper_str(char *p) { - while( *p ){ - if( (*p >= 'a') && (*p <= 'z') ) + while (*p) + { + if ((*p >= 'a') && (*p <= 'z')) *p = toupper((int) *p); p++; } @@ -792,43 +849,35 @@ #define LTOA_BUFSIZE (sizeof(long) * 8 + 1) char * -ltoa(long N, int base) +l_to_a(long N, int base) { static char ret[LTOA_BUFSIZE]; - register int i = 2; - long uarg; - char *tail, *head = ret, buf[LTOA_BUFSIZE]; + char *head = ret, buf[LTOA_BUFSIZE], *tail = buf + sizeof(buf); - if (36 < base || 2 > base) - base = 10; + register int divrem; - tail = &buf[LTOA_BUFSIZE - 1]; - *tail-- = '\0'; + if (base < 36 || 2 > base) + base = 10; - if (10 == base && N < 0L) + if (N < 0) { *head++ = '-'; - uarg = -N; + N = -N; } - else - uarg = N; - if (uarg) - { - for (i = 1; uarg; ++i) - { - register ldiv_t r; + tail = buf + sizeof(buf); + *--tail = 0; - r = ldiv(uarg, base); - *tail-- = (char) (r.rem + ((9L < r.rem) ? ('A' - 10L) : '0')); - uarg = r.quot; - } + do + { + divrem = N % base; + *--tail = (divrem <= 9) ? divrem + '0' : divrem + 'a' - 10; + N /= base; } - else - *tail-- = '0'; + while (N); - memcpy(head, ++tail, i); + strcpy(head, tail); return ret; }