Added option "-t" to specify the window title.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13797 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2005-07-21 23:52:06 +00:00
parent 7f53c2cc96
commit 4cbc183b53
3 changed files with 14 additions and 3 deletions
+11 -2
View File
@@ -21,7 +21,8 @@ static const char *kUsage =
" -h, --help - print this info text\n"
" -l <x> <y> - open the terminal window at location (<x>, <y>)\n"
" -s <width> <height> - open the terminal window with width <width> and\n"
" height <height>)\n";
" height <height>)\n"
" -t <title> - set the terminal window title to <title>\n";
// application name
const char *kAppName = __progname;
@@ -43,7 +44,8 @@ Arguments::Arguments()
: fBounds(50, 50, 630, 435),
fStandardShell(true),
fShellArgumentCount(0),
fShellArguments(NULL)
fShellArguments(NULL),
fTitle("MiniTerminal")
{
const char *argv[] = { "/bin/sh", "--login" };
@@ -91,6 +93,13 @@ Arguments::Parse(int argc, const char *const *argv)
fBounds.right = fBounds.left + width;
fBounds.bottom = fBounds.top + height;
} else if (strcmp(arg, "-t") == 0) {
// title
if (argi >= argc)
print_usage_and_exit(true);
fTitle = argv[argi++];
} else {
// illegal option
fprintf(stderr, "Unrecognized option \"%s\"\n", arg);
+2
View File
@@ -16,6 +16,7 @@ public:
void Parse(int argc, const char *const *argv);
BRect Bounds() const { return fBounds; }
const char *Title() const { return fTitle; }
bool StandardShell() const { return fStandardShell; }
void GetShellArguments(int &argc, const char *const *&argv) const;
@@ -26,6 +27,7 @@ private:
bool fStandardShell;
int fShellArgumentCount;
const char **fShellArguments;
const char *fTitle;
};
+1 -1
View File
@@ -10,7 +10,7 @@
#include "MiniWin.h"
MiniWin::MiniWin(const Arguments &args)
: BWindow(args.Bounds(), "MiniTerminal", B_TITLED_WINDOW,
: BWindow(args.Bounds(), args.Title(), B_TITLED_WINDOW,
B_QUIT_ON_WINDOW_CLOSE)
{
fView = new MiniView(args);