Add command line argument to specify usage of the CLI rather than the GUI.

Not used yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43158 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-11-03 12:21:06 +00:00
parent 8f1b66b114
commit 192c6f9689
+16 -3
View File
@@ -54,6 +54,7 @@ static const char* kUsage =
"\n" "\n"
"Options:\n" "Options:\n"
" -h, --help - Print this usage info and exit.\n" " -h, --help - Print this usage info and exit.\n"
" -c, --cli - Use command line user interface (not yet implemented)\n"
; ;
@@ -71,13 +72,15 @@ struct Options {
const char* const* commandLineArgv; const char* const* commandLineArgv;
team_id team; team_id team;
thread_id thread; thread_id thread;
bool useCLI;
Options() Options()
: :
commandLineArgc(0), commandLineArgc(0),
commandLineArgv(NULL), commandLineArgv(NULL),
team(-1), team(-1),
thread(-1) thread(-1),
useCLI(false)
{ {
} }
}; };
@@ -94,16 +97,21 @@ parse_arguments(int argc, const char* const* argv, bool noOutput,
{ "help", no_argument, 0, 'h' }, { "help", no_argument, 0, 'h' },
{ "team", required_argument, 0, 't' }, { "team", required_argument, 0, 't' },
{ "thread", required_argument, 0, 'T' }, { "thread", required_argument, 0, 'T' },
{ "cli", no_argument, 0, 'c' },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
opterr = 0; // don't print errors opterr = 0; // don't print errors
int c = getopt_long(argc, (char**)argv, "+h", sLongOptions, NULL); int c = getopt_long(argc, (char**)argv, "+ch", sLongOptions, NULL);
if (c == -1) if (c == -1)
break; break;
switch (c) { switch (c) {
case 'c':
options.useCLI = true;
break;
case 'h': case 'h':
if (noOutput) if (noOutput)
return false; return false;
@@ -324,6 +332,10 @@ Debugger::ArgvReceived(int32 argc, char** argv)
stopInMain = true; stopInMain = true;
} }
// no parameters given, prompt the user to attach to a team
if (team < 0 && thread < 0)
return;
// If we've got // If we've got
if (team < 0) { if (team < 0) {
printf("no team yet, getting thread info...\n"); printf("no team yet, getting thread info...\n");
@@ -430,7 +442,8 @@ Debugger::_FindTeamDebugger(team_id teamID) const
TeamDebugger* TeamDebugger*
Debugger::_StartTeamDebugger(team_id teamID, thread_id threadID, bool stopInMain) Debugger::_StartTeamDebugger(team_id teamID, thread_id threadID,
bool stopInMain)
{ {
if (teamID < 0) if (teamID < 0)
return NULL; return NULL;