--- sourceforge.net/trunk/rdesktop/rdesktop.c 2004/01/23 14:37:51 582 +++ sourceforge.net/trunk/rdesktop/rdesktop.c 2004/03/05 06:39:00 630 @@ -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"); @@ -129,8 +131,9 @@ 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"); + " or mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n"); + fprintf(stderr, " '-r sound:[local|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"); @@ -251,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) { @@ -347,6 +350,10 @@ g_orders = False; break; + case 'B': + g_ownbackstore = False; + break; + case 'e': g_encryption = False; break; @@ -408,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("local", optarg, 5) == 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) { @@ -457,7 +490,7 @@ } } - if (argc - optind < 1) + if (argc - optind != 1) { usage(argv[0]); return 1; @@ -732,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. @@ -814,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; }