* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Only raise SIGPIPE
when writing. * fhandler.h: Include "tty.h". (fhandler_termios::_tc): Rename from tc. (fhandler_termios::tc): New method. (fhandler_termios::tcinit): Remove an argument. (fhandler_termios::get_ttyp): Use method to retrieve value. (fhandler_console::console_state): Move here. (fhandler_console::dev_state): Delete. (fhandler_console::shared_console_info): Define. (fhandler_console::open_shared_console): Move this function under fhandler_console umbrella. (fhandler_console::tc): Define. Return static value. (fhandler_console::focus_aware): Accommodate deletion of dev_state. (fhandler_console): Add tty_list::get_cttyp as a friend. * fhandler_console.cc (dev_state): Redefine as a pointer within shared_console_info and change dev-> to dev. throughout. (fhandler_console::shared_console_info): Move into fhandler_console. (fhandler_console::open_shared_console): Move into fhandler_console change argument to simple bool. (enum_windows): Accommodate changes to console_state and open_shared_console. (console_unit::console_unit): Ditto. (fhandler_console::get_tty_stuff): Accommodate change to dev_state. (tty_list::get_cttyp): Accommodate change to handler_console::shared_console_info. (fhandler_console::read): Accommodate change from tc to tc (). (fhandler_console::set_input_state): Ditto. (fhandler_console::open): Accommodate tcinit argument change and change from tc to tc(). (fhandler_console::input_tcsetattr): Accomodate change from tc to tc(). (fhandler_console::input_tcsetattr): Ditto. (fhandler_console::write_normal): Ditto. (fhandler_console::init): Ditto. (fhandler_console::igncr_enabled): Ditto. * fhandler_termios.cc (fhandler_termios::tcinit): Remove first argument. Expect tc() to have been set up first. Use tc() rather than tc. (fhandler_termios::tcsetpgrp): Accomodate change from tc to tc(). (fhandler_termios::tcgetpgrp): Ditto. (fhandler_termios::bg_check): Ditto. (fhandler_termios::line_edit: Ditto. (fhandler_tty_master::set_winsize): Ditto. (fhandler_tty_slave::open): Ditto. (fhandler_tty_slave::init): Ditto. (fhandler_pty_master::write): Ditto. (fhandler_pty_master::setup): Ditto. Accommodate change in arguments to tcinit. (fhandler_tty_slave::fch_open_handles): Set _tc directly. (tty_min::is_orphaned_process_group): Don't assume that parent pid exists. * pinfo.cc (_pinfo::set_ctty): Reset myself->{pgid,sid} here if we were started by a non-Cygwin process but the tty exists. * shared_info.h (console_state): Delete from here. * tty.h: Make multiple inclusion safe.
This commit is contained in:
@ -12,6 +12,7 @@ details. */
|
||||
#ifndef _FHANDLER_H_
|
||||
#define _FHANDLER_H_
|
||||
|
||||
#include "tty.h"
|
||||
/* fcntl flags used only internaly. */
|
||||
#define O_NOSYMLINK 0x080000
|
||||
#define O_DIROPEN 0x100000
|
||||
@ -925,7 +926,8 @@ class fhandler_termios: public fhandler_base
|
||||
virtual void doecho (const void *, DWORD) {};
|
||||
virtual int accept_input () {return 1;};
|
||||
public:
|
||||
tty_min *tc;
|
||||
tty_min *_tc;
|
||||
virtual tty_min *tc () const {return _tc; }
|
||||
fhandler_termios () :
|
||||
fhandler_base ()
|
||||
{
|
||||
@ -934,9 +936,9 @@ class fhandler_termios: public fhandler_base
|
||||
HANDLE& get_output_handle () { return output_handle; }
|
||||
line_edit_status line_edit (const char *rptr, int nread, termios&);
|
||||
void set_output_handle (HANDLE h) { output_handle = h; }
|
||||
void tcinit (tty_min *this_tc, bool force);
|
||||
void tcinit (bool force);
|
||||
bool is_tty () const { return true; }
|
||||
tty *get_ttyp () { return (tty *) tc; }
|
||||
tty *get_ttyp () { return (tty *) tc (); }
|
||||
void sigflush ();
|
||||
int tcgetpgrp ();
|
||||
int tcsetpgrp (int pid);
|
||||
@ -1041,9 +1043,15 @@ class dev_console
|
||||
/* This is a input and output console handle */
|
||||
class fhandler_console: public fhandler_termios
|
||||
{
|
||||
private:
|
||||
public:
|
||||
struct console_state
|
||||
{
|
||||
tty_min tty_min_state;
|
||||
dev_console dev_state;
|
||||
};
|
||||
private:
|
||||
static const unsigned MAX_WRITE_CHARS;
|
||||
static dev_console *dev_state;
|
||||
static console_state *shared_console_info;
|
||||
static bool invisible_console;
|
||||
|
||||
/* Used when we encounter a truncated multi-byte sequence. The
|
||||
@ -1075,9 +1083,16 @@ class fhandler_console: public fhandler_termios
|
||||
void set_cursor_maybe ();
|
||||
static bool create_invisible_console (HWINSTA);
|
||||
static bool create_invisible_console_workaround ();
|
||||
static console_state *open_shared_console (HWND, HANDLE&, bool&);
|
||||
tty_min *tc () const {return &(shared_console_info->tty_min_state);}
|
||||
|
||||
public:
|
||||
fhandler_console ();
|
||||
static console_state *open_shared_console (HWND hw, HANDLE& h)
|
||||
{
|
||||
bool createit = false;
|
||||
return open_shared_console (hw, h, createit);
|
||||
}
|
||||
|
||||
fhandler_console* is_console () { return this; }
|
||||
|
||||
@ -1098,7 +1113,7 @@ class fhandler_console: public fhandler_termios
|
||||
int ioctl (unsigned int cmd, void *);
|
||||
int init (HANDLE, DWORD, mode_t);
|
||||
bool mouse_aware (MOUSE_EVENT_RECORD& mouse_event);
|
||||
bool focus_aware () {return dev_state->use_focus;}
|
||||
bool focus_aware () {return shared_console_info->dev_state.use_focus;}
|
||||
|
||||
select_record *select_read (select_stuff *);
|
||||
select_record *select_write (select_stuff *);
|
||||
@ -1114,6 +1129,7 @@ class fhandler_console: public fhandler_termios
|
||||
static bool need_invisible ();
|
||||
static bool has_a () {return !invisible_console;}
|
||||
size_t size () const { return sizeof (*this);}
|
||||
friend tty_min * tty_list::get_cttyp ();
|
||||
};
|
||||
|
||||
class fhandler_tty_common: public fhandler_termios
|
||||
|
Reference in New Issue
Block a user