From 2054cd23889b8a0238ae6ded8e4e3bf02cb8dd05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Sun, 1 Sep 2002 11:27:58 +0000 Subject: [PATCH] Added -w option for setting title git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@106 423420c4-83ab-492f-b58f-81f9feb106b5 --- doc/rdesktop.1 | 3 +++ rdesktop.c | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/rdesktop.1 b/doc/rdesktop.1 index d818787..180ab59 100644 --- a/doc/rdesktop.1 +++ b/doc/rdesktop.1 @@ -77,6 +77,9 @@ Connect to this TCP port. The default is 3389. .TP .BR "-K" Keep window manager key bindings. +.TP +.BR "-w " +Set window title to <title>. .PP .SH "RETURN VALUES" diff --git a/rdesktop.c b/rdesktop.c index 4e15eec..3daafeb 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -29,7 +29,7 @@ #include <sys/times.h> /* times */ #include "rdesktop.h" -char title[32]; +char title[32] = ""; char username[16]; char hostname[16]; char keymapname[16]; @@ -67,6 +67,7 @@ usage(char *program) printf(" -l: do not request licence\n"); printf(" -t: rdp tcp port\n"); printf(" -K: keep window manager key bindings\n"); + printf(" -w: window title\n"); } /* Client program */ @@ -92,7 +93,7 @@ main(int argc, char *argv[]) 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) { @@ -175,6 +176,10 @@ main(int argc, char *argv[]) grab_keyboard = False; break; + case 'w': + strncpy(title, optarg, sizeof(title)); + break; + case 'h': case '?': default: @@ -240,8 +245,11 @@ main(int argc, char *argv[]) width = (width + 3) & ~3; } - strcpy(title, "rdesktop - "); - strncat(title, server, sizeof(title) - sizeof("rdesktop - ")); + if (!strlen(title)) + { + strcpy(title, "rdesktop - "); + strncat(title, server, sizeof(title) - sizeof("rdesktop - ")); + } xkeymap_init1(); if (!ui_init())