Shell.h revision 258e949475ef1971cc5560dd0715f7199123e7a4
1/*
2 * Copyright 2007 Haiku, Inc.
3 * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
4 * Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
5 * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
6 * Distributed under the terms of the MIT License.
7 * Authors:
8 *		Stefano Ceccherini <stefano.ceccherini@gmail.com>
9 *		Kian Duffy <myob@users.sourceforge.net>
10 *		Kazuho Okui
11 *		Takashi Murai
12 */
13#ifndef _SHELL_H
14#define _SHELL_H
15
16#include <SupportDefs.h>
17
18// TODO: Maybe merge TermParse and Shell classes ?
19class TermParse;
20class TermView;
21class Shell {
22public:
23			Shell();
24	virtual		~Shell();
25
26	status_t	Open(int row, int col, const char *command, const char *coding);
27	void		Close();
28
29	const char *	TTYName() const;
30
31	ssize_t		Read(void *buffer, size_t numBytes);
32	ssize_t		Write(const void *buffer, size_t numBytes);
33
34	status_t	UpdateWindowSize(int row, int columns);
35	status_t	Signal(int signal);
36
37	status_t	GetAttr(struct termios &attr);
38	status_t	SetAttr(struct termios &attr);
39
40	int		FD() const;
41
42	virtual	void	ViewAttached(TermView *view);
43	virtual void	ViewDetached();
44
45private:
46	int		fFd;
47	pid_t		fProcessID;
48	TermParse	*fTermParse;
49	bool		fAttached;
50
51	status_t	_Spawn(int row, int col, const char *command, const char *coding);
52};
53
54#endif // _SHELL_H
55