Creating a new tab in terminal would show an error message (but still

worked). Fixed. Also moved handling of default shell command from 
TermView to Shell, where it belongs. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23557 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2008-01-16 09:35:29 +00:00
parent dd80f32ac3
commit 523f71ee2b
2 changed files with 12 additions and 58 deletions
+12 -8
View File
@@ -55,10 +55,6 @@
#endif
/* default shell command and options. */
const char *kDefaultShellCommand = { "/bin/sh" "-login" };
/*
* Set environment variable.
*/
@@ -273,6 +269,13 @@ receive_handshake_message(handshake_t& handshake)
status_t
Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **argv)
{
const char *kDefaultShellCommand[] = { "/bin/sh", "--login" };
if (argv == NULL || argc == 0) {
argv = kDefaultShellCommand;
argc = 2;
}
signal(SIGTTOU, SIG_IGN);
/*
@@ -480,9 +483,9 @@ Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **arg
setenv("TERM", "beterm", true);
setenv("TTY", ttyName, true);
setenv("TTYPE", encoding, true);
setenv("SHELL", *argv, true);
setenv("SHELL", argv[0], true);
execve(*argv, (char * const *)argv, environ);
execve(argv[0], (char * const *)argv, environ);
/*
* Exec failed.
@@ -493,11 +496,12 @@ Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **arg
"\t%s' "
"'Use Default Shell' 'Abort'";
char errorMessage[256];
snprintf(errorMessage, sizeof(errorMessage), spawnAlertMessage, *argv, strerror(errno));
snprintf(errorMessage, sizeof(errorMessage), spawnAlertMessage, argv[0], strerror(errno));
int returnValue = system(errorMessage);
if (returnValue == 0)
execl("/bin/sh", "/bin/sh", "-login", NULL);
execl(kDefaultShellCommand[0], kDefaultShellCommand[0],
kDefaultShellCommand[1], NULL);
exit(1);
}
-50
View File
@@ -59,49 +59,6 @@ const static rgb_color kTermColorTable[8] = {
};
const unsigned char M_ADD_CURSOR[] = {
16, // Size
1, // Color depth
0, // Hot spot y
1, // Hot spot x
// Cursor image
0x70, 0x00,
0x48, 0x00,
0x48, 0x00,
0x27, 0xc0,
0x24, 0xb8,
0x12, 0x54,
0x10, 0x02,
0x78, 0x02,
0x98, 0x02,
0x84, 0x02,
0x60, 0x02,
0x18, 0x12,
0x04, 0x10,
0x02, 0x7c,
0x00, 0x10,
0x00, 0x10,
// Mask image
0x70, 0x00,
0x78, 0x00,
0x78, 0x00,
0x3f, 0xc0,
0x3f, 0xf8,
0x1f, 0xfc,
0x1f, 0xfe,
0x7f, 0xfe,
0xff, 0xfe,
0xff, 0xfe,
0x7f, 0xfe,
0x1f, 0xfe,
0x07, 0xfc,
0x03, 0xfc,
0x00, 0x10,
0x00, 0x10,
};
#define ROWS_DEFAULT 25
#define COLUMNS_DEFAULT 80
@@ -286,13 +243,6 @@ TermView::TermView(BMessage *archive)
status_t
TermView::_InitObject(int32 argc, const char **argv)
{
const char *defaultArgv[] = { "/bin/sh", "--login" };
if (argc == 0 || argv == NULL) {
argc = 2;
argv = defaultArgv;
}
SetTermFont(be_fixed_font, be_fixed_font);
fTextBuffer = new (std::nothrow) TermBuffer(fTermRows, fTermColumns, fScrBufSize);