more style cleanups, removed unused global
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21542 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -135,7 +135,7 @@ TermApp::Quit()
|
||||
if (!gUsageRequested){
|
||||
int status;
|
||||
|
||||
kill(-sh_pid, SIGHUP);
|
||||
kill(-gShPid, SIGHUP);
|
||||
wait(&status);
|
||||
|
||||
_UnregisterTerminal();
|
||||
|
||||
@@ -1015,7 +1015,7 @@ TermView::UpdateSIGWINCH()
|
||||
ws.ws_row = fTermRows;
|
||||
ws.ws_col = fTermColumns;
|
||||
ioctl(fTerminalFd, TIOCSWINSZ, &ws);
|
||||
kill(-sh_pid, SIGWINCH);
|
||||
kill(-gShPid, SIGWINCH);
|
||||
|
||||
fFrameResized = 0;
|
||||
if (fScrRegionSet == 0)
|
||||
@@ -1214,7 +1214,7 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
tcgetattr(fTerminalFd, &tio);
|
||||
if (*bytes == tio.c_cc[VINTR]) {
|
||||
if (tio.c_lflag & ISIG)
|
||||
kill(-sh_pid, SIGINT);
|
||||
kill(-gShPid, SIGINT);
|
||||
}
|
||||
|
||||
// Terminal changes RET, ENTER, F1...F12, and ARROW key code.
|
||||
|
||||
@@ -311,7 +311,7 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
|
||||
// try launching two different ways to work around possible problems
|
||||
if (be_roster->Launch(&info.ref)!=B_OK)
|
||||
be_roster->Launch(TERM_SIGNATURE);
|
||||
be_roster->Launch(TERM_SIGNATURE);
|
||||
break;
|
||||
}
|
||||
case MENU_PREF_OPEN: {
|
||||
@@ -546,9 +546,9 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
break;
|
||||
}
|
||||
case MSG_FONT_CHANGED: {
|
||||
gTermPref->setString (PREF_HALF_FONT_FAMILY, fNewFontMenu->FindMarked()->Label());
|
||||
this->PostMessage (MSG_HALF_FONT_CHANGED);
|
||||
break;
|
||||
gTermPref->setString (PREF_HALF_FONT_FAMILY, fNewFontMenu->FindMarked()->Label());
|
||||
PostMessage (MSG_HALF_FONT_CHANGED);
|
||||
break;
|
||||
}
|
||||
case MSG_COLOR_CHANGED: {
|
||||
fBaseView->SetViewColor (gTermPref->getRGB (PREF_TEXT_BACK_COLOR));
|
||||
@@ -604,19 +604,6 @@ TermWindow::QuitRequested()
|
||||
}
|
||||
|
||||
|
||||
//! Get Machine Timezone.
|
||||
int
|
||||
TermWindow::GetTimeZone()
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timezone tm;
|
||||
|
||||
gettimeofday (&tv, &tm);
|
||||
|
||||
return -tm.tz_minuteswest / 60;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::TermWinActivate()
|
||||
{
|
||||
@@ -635,27 +622,30 @@ TermWindow::TermWinActivate()
|
||||
status_t
|
||||
TermWindow::GetSupportedSuites(BMessage *msg)
|
||||
{
|
||||
static property_info prop_list[] = {
|
||||
{ "encode",
|
||||
{B_GET_PROPERTY, 0},
|
||||
{B_DIRECT_SPECIFIER, 0},
|
||||
"get muterminal encode"},
|
||||
{ "encode",
|
||||
{B_SET_PROPERTY, 0},
|
||||
{B_DIRECT_SPECIFIER, 0},
|
||||
"set muterminal encode"},
|
||||
{ "tty",
|
||||
{B_GET_PROPERTY, 0},
|
||||
{B_DIRECT_SPECIFIER, 0},
|
||||
"get tty_name."},
|
||||
{ 0 }
|
||||
|
||||
};
|
||||
msg->AddString("suites", "suite/vnd.naan-termwindow");
|
||||
BPropertyInfo prop_info(prop_list);
|
||||
msg->AddFlat("messages", &prop_info);
|
||||
return BWindow::GetSupportedSuites(msg);
|
||||
static property_info propList[] = {
|
||||
{ "encode",
|
||||
{B_GET_PROPERTY, 0},
|
||||
{B_DIRECT_SPECIFIER, 0},
|
||||
"get muterminal encode"},
|
||||
{ "encode",
|
||||
{B_SET_PROPERTY, 0},
|
||||
{B_DIRECT_SPECIFIER, 0},
|
||||
"set muterminal encode"},
|
||||
{ "tty",
|
||||
{B_GET_PROPERTY, 0},
|
||||
{B_DIRECT_SPECIFIER, 0},
|
||||
"get tty_name."},
|
||||
{ 0 }
|
||||
|
||||
};
|
||||
|
||||
msg->AddString("suites", "suite/vnd.naan-termwindow");
|
||||
BPropertyInfo propInfo(propList);
|
||||
msg->AddFlat("messages", &propInfo);
|
||||
return BWindow::GetSupportedSuites(msg);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ResolveSpecifier
|
||||
//
|
||||
@@ -665,28 +655,26 @@ TermWindow::ResolveSpecifier(BMessage *msg, int32 index,
|
||||
BMessage *specifier, int32 form,
|
||||
const char *property)
|
||||
{
|
||||
if ( (strcmp(property, "encode") == 0)
|
||||
&& ((msg->what == B_SET_PROPERTY) || (msg->what == B_GET_PROPERTY) ))
|
||||
return this;
|
||||
else if ( (strcmp(property, "tty") == 0)
|
||||
&& (msg->what == B_GET_PROPERTY) )
|
||||
return this;
|
||||
if (((strcmp(property, "encode") == 0)
|
||||
&& ((msg->what == B_SET_PROPERTY) || (msg->what == B_GET_PROPERTY)))
|
||||
|| ((strcmp(property, "tty") == 0) && (msg->what == B_GET_PROPERTY)))
|
||||
return this;
|
||||
|
||||
return BWindow::ResolveSpecifier(msg, index, specifier, form, property);
|
||||
return BWindow::ResolveSpecifier(msg, index, specifier, form, property);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// SetCoding
|
||||
// Set coding utility functions.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void SetCoding (int coding)
|
||||
void
|
||||
SetCoding(int coding)
|
||||
{
|
||||
const etable *p = encoding_table;
|
||||
p += coding;
|
||||
const etable *p = encoding_table;
|
||||
p += coding;
|
||||
|
||||
gNowCoding = coding;
|
||||
|
||||
return;
|
||||
gNowCoding = coding;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ class TermWindow : public BWindow {
|
||||
private:
|
||||
void InitWindow();
|
||||
void SetupMenu();
|
||||
int GetTimeZone();
|
||||
status_t DoPageSetup();
|
||||
void DoPrint();
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ typedef struct
|
||||
|
||||
/* global variables */
|
||||
|
||||
pid_t sh_pid;
|
||||
pid_t gShPid;
|
||||
|
||||
|
||||
static status_t
|
||||
@@ -184,12 +184,12 @@ spawn_shell(int row, int col, const char *command, const char *coding)
|
||||
thread_id terminalThread = find_thread(NULL);
|
||||
|
||||
/* Fork a child process. */
|
||||
if ((sh_pid = fork()) < 0) {
|
||||
if ((gShPid = fork()) < 0) {
|
||||
close(master);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sh_pid == 0) {
|
||||
if (gShPid == 0) {
|
||||
// Now in child process.
|
||||
|
||||
/*
|
||||
@@ -442,7 +442,7 @@ spawn_shell(int row, int col, const char *command, const char *coding)
|
||||
handshake.row = row;
|
||||
handshake.col = col;
|
||||
handshake.status = PTY_WS;
|
||||
send_handshake_message(sh_pid, handshake);
|
||||
send_handshake_message(gShPid, handshake);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +87,7 @@
|
||||
int spawn_shell (int, int, const char *, const char *);
|
||||
void Setenv (const char *, const char *);
|
||||
|
||||
extern pid_t sh_pid; /* shell process ID */
|
||||
extern int gPfd_num; /* number of gPfd */
|
||||
extern pid_t gShPid; /* shell process ID */
|
||||
|
||||
|
||||
#endif /* SPAWN_H */
|
||||
|
||||
Reference in New Issue
Block a user