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:
@@ -10,7 +10,7 @@
|
|||||||
#include "Arguments.h"
|
#include "Arguments.h"
|
||||||
|
|
||||||
|
|
||||||
Arguments::Arguments()
|
Arguments::Arguments(int defaultArgsNum, const char * const *defaultArgs)
|
||||||
: fUsageRequested(false),
|
: fUsageRequested(false),
|
||||||
fBounds(50, 50, 630, 435),
|
fBounds(50, 50, 630, 435),
|
||||||
fStandardShell(true),
|
fStandardShell(true),
|
||||||
@@ -19,9 +19,7 @@ Arguments::Arguments()
|
|||||||
fShellArguments(NULL),
|
fShellArguments(NULL),
|
||||||
fTitle(NULL)
|
fTitle(NULL)
|
||||||
{
|
{
|
||||||
const char *argv[] = { "/bin/bash", "--login" };
|
_SetShellArguments(defaultArgsNum, defaultArgs);
|
||||||
|
|
||||||
_SetShellArguments(2, argv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
class Arguments {
|
class Arguments {
|
||||||
public:
|
public:
|
||||||
Arguments();
|
Arguments(int defaultArgcNum, const char *const *defaultArgv);
|
||||||
~Arguments();
|
~Arguments();
|
||||||
|
|
||||||
void Parse(int argc, const char *const *argv);
|
void Parse(int argc, const char *const *argv);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "TermApp.h"
|
#include "TermApp.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <pwd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -35,7 +36,7 @@
|
|||||||
static bool sUsageRequested = false;
|
static bool sUsageRequested = false;
|
||||||
//static bool sGeometryRequested = false;
|
//static bool sGeometryRequested = false;
|
||||||
|
|
||||||
|
const char *kDefaultShell = "/bin/bash";
|
||||||
const ulong MSG_ACTIVATE_TERM = 'msat';
|
const ulong MSG_ACTIVATE_TERM = 'msat';
|
||||||
const ulong MSG_TERM_WINDOW_INFO = 'mtwi';
|
const ulong MSG_TERM_WINDOW_INFO = 'mtwi';
|
||||||
|
|
||||||
@@ -57,7 +58,19 @@ TermApp::TermApp()
|
|||||||
fTermWindow(NULL),
|
fTermWindow(NULL),
|
||||||
fArgs(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";
|
fWindowTitle = "Terminal";
|
||||||
_RegisterTerminal();
|
_RegisterTerminal();
|
||||||
|
|||||||
Reference in New Issue
Block a user