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:
@@ -21,7 +21,8 @@ static const char *kUsage =
|
|||||||
" -h, --help - print this info text\n"
|
" -h, --help - print this info text\n"
|
||||||
" -l <x> <y> - open the terminal window at location (<x>, <y>)\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"
|
" -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
|
// application name
|
||||||
const char *kAppName = __progname;
|
const char *kAppName = __progname;
|
||||||
@@ -43,7 +44,8 @@ Arguments::Arguments()
|
|||||||
: fBounds(50, 50, 630, 435),
|
: fBounds(50, 50, 630, 435),
|
||||||
fStandardShell(true),
|
fStandardShell(true),
|
||||||
fShellArgumentCount(0),
|
fShellArgumentCount(0),
|
||||||
fShellArguments(NULL)
|
fShellArguments(NULL),
|
||||||
|
fTitle("MiniTerminal")
|
||||||
{
|
{
|
||||||
const char *argv[] = { "/bin/sh", "--login" };
|
const char *argv[] = { "/bin/sh", "--login" };
|
||||||
|
|
||||||
@@ -91,6 +93,13 @@ Arguments::Parse(int argc, const char *const *argv)
|
|||||||
fBounds.right = fBounds.left + width;
|
fBounds.right = fBounds.left + width;
|
||||||
fBounds.bottom = fBounds.top + height;
|
fBounds.bottom = fBounds.top + height;
|
||||||
|
|
||||||
|
} else if (strcmp(arg, "-t") == 0) {
|
||||||
|
// title
|
||||||
|
if (argi >= argc)
|
||||||
|
print_usage_and_exit(true);
|
||||||
|
|
||||||
|
fTitle = argv[argi++];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// illegal option
|
// illegal option
|
||||||
fprintf(stderr, "Unrecognized option \"%s\"\n", arg);
|
fprintf(stderr, "Unrecognized option \"%s\"\n", arg);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public:
|
|||||||
void Parse(int argc, const char *const *argv);
|
void Parse(int argc, const char *const *argv);
|
||||||
|
|
||||||
BRect Bounds() const { return fBounds; }
|
BRect Bounds() const { return fBounds; }
|
||||||
|
const char *Title() const { return fTitle; }
|
||||||
bool StandardShell() const { return fStandardShell; }
|
bool StandardShell() const { return fStandardShell; }
|
||||||
void GetShellArguments(int &argc, const char *const *&argv) const;
|
void GetShellArguments(int &argc, const char *const *&argv) const;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ private:
|
|||||||
bool fStandardShell;
|
bool fStandardShell;
|
||||||
int fShellArgumentCount;
|
int fShellArgumentCount;
|
||||||
const char **fShellArguments;
|
const char **fShellArguments;
|
||||||
|
const char *fTitle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "MiniWin.h"
|
#include "MiniWin.h"
|
||||||
|
|
||||||
MiniWin::MiniWin(const Arguments &args)
|
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)
|
B_QUIT_ON_WINDOW_CLOSE)
|
||||||
{
|
{
|
||||||
fView = new MiniView(args);
|
fView = new MiniView(args);
|
||||||
|
|||||||
Reference in New Issue
Block a user