--- sourceforge.net/trunk/rdesktop/rdesktop.c 2002/08/29 14:18:24 103 +++ sourceforge.net/trunk/rdesktop/rdesktop.c 2002/09/17 09:20:13 171 @@ -1,7 +1,7 @@ /* rdesktop: A Remote Desktop Protocol client. Entrypoint and utility functions - Copyright (C) Matthew Chapman 1999-2001 + Copyright (C) Matthew Chapman 1999-2002 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ #include /* times */ #include "rdesktop.h" -char title[32]; +char title[32] = ""; char username[16]; char hostname[16]; char keymapname[16]; int keylayout = 0x409; /* Defaults to US keyboard layout */ -int width; -int height; +int width = 800; +int height = 600; int tcp_port_rdp = TCP_PORT_RDP; BOOL bitmap_compression = True; BOOL sendmotion = True; @@ -50,23 +50,28 @@ static void usage(char *program) { - printf("Usage: %s [options] server\n", program); - printf(" -u: user name\n"); - printf(" -d: domain\n"); - printf(" -s: shell\n"); - printf(" -c: working directory\n"); - printf(" -p: password (autologon)\n"); - printf(" -P: askpass-program (autologon)\n"); - printf(" -n: client hostname\n"); - printf(" -k: keyboard layout on terminal server (us,sv,gr etc.)\n"); - printf(" -g: desktop geometry (WxH)\n"); - printf(" -f: full-screen mode\n"); - printf(" -b: force bitmap updates\n"); - printf(" -e: disable encryption (French TS)\n"); - printf(" -m: do not send motion events\n"); - printf(" -l: do not request licence\n"); - printf(" -t: rdp tcp port\n"); - printf(" -K: keep window manager key bindings\n"); + fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); + fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2002 Matt Chapman.\n"); + fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); + + fprintf(stderr, "Usage: %s [options] server\n", program); + fprintf(stderr, " -u: user name\n"); + fprintf(stderr, " -d: domain\n"); + fprintf(stderr, " -s: shell\n"); + fprintf(stderr, " -c: working directory\n"); + fprintf(stderr, " -p: password (autologon)\n"); + fprintf(stderr, " -P: askpass-program (autologon)\n"); + fprintf(stderr, " -n: client hostname\n"); + fprintf(stderr, " -k: keyboard layout on terminal server (us,sv,gr etc.)\n"); + fprintf(stderr, " -g: desktop geometry (WxH)\n"); + fprintf(stderr, " -f: full-screen mode\n"); + fprintf(stderr, " -b: force bitmap updates\n"); + fprintf(stderr, " -e: disable encryption (French TS)\n"); + fprintf(stderr, " -m: do not send motion events\n"); + fprintf(stderr, " -l: do not request licence\n"); + fprintf(stderr, " -t: rdp tcp port\n"); + fprintf(stderr, " -K: keep window manager key bindings\n"); + fprintf(stderr, " -w: window title\n"); } /* Client program */ @@ -84,15 +89,11 @@ uint32 flags; int c; - printf("rdesktop: A Remote Desktop Protocol client.\n"); - printf("Version " VERSION ". Copyright (C) 1999-2001 Matt Chapman.\n"); - printf("See http://www.rdesktop.org/ for more information.\n\n"); - flags = RDP_LOGON_NORMAL; domain[0] = password[0] = shell[0] = directory[0] = 0; strcpy(keymapname, "us"); - while ((c = getopt(argc, argv, "u:d:s:c:p:P:n:k:g:t:fbemlKh?")) != -1) + while ((c = getopt(argc, argv, "u:d:s:c:p:P:n:k:g:t:fbemlKw:h?")) != -1) { switch (c) { @@ -115,6 +116,9 @@ case 'p': STRNCPY(password, optarg, sizeof(password)); flags |= RDP_LOGON_AUTO; + p = optarg; + while (*p) + *(p++) = 'X'; break; case 'P': @@ -175,6 +179,10 @@ grab_keyboard = False; break; + case 'w': + strncpy(title, optarg, sizeof(title)); + break; + case 'h': case '?': default: @@ -229,28 +237,19 @@ STRNCPY(password, p, sizeof(password)); } - if ((width == 0) || (height == 0)) + if (!strlen(title)) { - width = 800; - height = 600; + strcpy(title, "rdesktop - "); + strncat(title, server, sizeof(title) - sizeof("rdesktop - ")); } - else - { - /* make sure width is a multiple of 4 */ - width = (width + 3) & ~3; - } - - strcpy(title, "rdesktop - "); - strncat(title, server, sizeof(title) - sizeof("rdesktop - ")); - xkeymap_init1(); if (!ui_init()) return 1; if (!rdp_connect(server, flags, domain, password, shell, directory)) return 1; - printf("Connection successful.\n"); + DEBUG(("Connection successful.\n")); if (ui_create_window()) { @@ -258,7 +257,7 @@ ui_destroy_window(); } - printf("Disconnecting...\n"); + DEBUG(("Disconnecting...\n")); rdp_disconnect(); return 0; } @@ -381,6 +380,7 @@ } } +#ifdef SAVE_LICENCE int load_licence(unsigned char **data) { @@ -434,3 +434,4 @@ write(fd, data, length); close(fd); } +#endif