Removed the shell invocation from Arguments, moved it into TermApp.

Get the user shell with getpwuid(), since this should be the correct way
to do it (and mmu_man wants it like this).
Note that when opening a new terminal tab, this is ignored, and a fixed
invocation is used (in the Shell class)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34902 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2010-01-04 22:59:18 +00:00
parent 71ddd07bcd
commit f7c5116756
3 changed files with 20 additions and 9 deletions
+2 -4
View File
@@ -10,7 +10,7 @@
#include "Arguments.h"
Arguments::Arguments()
Arguments::Arguments(int defaultArgsNum, const char * const *defaultArgs)
: fUsageRequested(false),
fBounds(50, 50, 630, 435),
fStandardShell(true),
@@ -19,9 +19,7 @@ Arguments::Arguments()
fShellArguments(NULL),
fTitle(NULL)
{
const char *argv[] = { "/bin/bash", "--login" };
_SetShellArguments(2, argv);
_SetShellArguments(defaultArgsNum, defaultArgs);
}
+1 -1
View File
@@ -10,7 +10,7 @@
class Arguments {
public:
Arguments();
Arguments(int defaultArgcNum, const char *const *defaultArgv);
~Arguments();
void Parse(int argc, const char *const *argv);
+17 -4
View File
@@ -10,6 +10,7 @@
#include "TermApp.h"
#include <errno.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -35,7 +36,7 @@
static bool sUsageRequested = false;
//static bool sGeometryRequested = false;
const char *kDefaultShell = "/bin/bash";
const ulong MSG_ACTIVATE_TERM = 'msat';
const ulong MSG_TERM_WINDOW_INFO = 'mtwi';
@@ -49,7 +50,7 @@ main()
return 0;
}
TermApp::TermApp()
: BApplication(TERM_SIGNATURE),
fStartFullscreen(false),
@@ -57,8 +58,20 @@ TermApp::TermApp()
fTermWindow(NULL),
fArgs(NULL)
{
fArgs = new Arguments();
const char *defaultArgs[2];
defaultArgs[0] = kDefaultShell;
defaultArgs[1] = "--login";
struct passwd passwdStruct;
struct passwd *passwdResult;
char stringBuffer[256];
if (!getpwuid_r(getuid(), &passwdStruct, stringBuffer,
sizeof(stringBuffer), &passwdResult)) {
defaultArgs[0] = passwdStruct.pw_shell;
}
fArgs = new Arguments(2, defaultArgs);
fWindowTitle = "Terminal";
_RegisterTerminal();