File: child.h

package info (click to toggle)
viewglob 2.0.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,740 kB
  • ctags: 968
  • sloc: ansic: 13,940; sh: 897; makefile: 315
file content (59 lines) | stat: -rw-r--r-- 1,462 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
	Copyright (C) 2004, 2005 Stephen Bach
	This file is part of the viewglob package.

	viewglob is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	viewglob is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with viewglob; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef CHILD_H
#define CHILD_H

#include "common.h"

G_BEGIN_DECLS


struct arguments {
	gchar** argv;
	gint arg_count;
};


struct child {
	gchar* exec_name;
	struct arguments args;
	pid_t pid;
	gint fd_in;
	gint fd_out;
};


#define NEW_PTY_FD -99
#define CLOSE_FD   -98
void     child_init(struct child* c);
gboolean child_fork(struct child* c);
gboolean pty_child_fork(struct child* c, gint new_stdin_fd, gint new_stdout_fd, gint new_stderr_fd);
gboolean child_running(struct child* c);
gboolean child_terminate(struct child* c);

void args_init(struct arguments* a);
void args_add(struct arguments* a, gchar* new_arg);

gboolean wait_for_data(gint fd);

G_END_DECLS

#endif /* !CHILD_H */