1 |
724 |
jeremybenn |
|
2 |
|
|
/*
|
3 |
|
|
* server.c Set up and handle communications with a server process.
|
4 |
|
|
*
|
5 |
|
|
* Server Handling copyright 1992-1999 The Free Software Foundation
|
6 |
|
|
*
|
7 |
|
|
* Server Handling is free software.
|
8 |
|
|
* You may redistribute it and/or modify it under the terms of the
|
9 |
|
|
* GNU General Public License, as published by the Free Software
|
10 |
|
|
* Foundation; either version 2, or (at your option) any later version.
|
11 |
|
|
*
|
12 |
|
|
* Server Handling is distributed in the hope that it will be useful,
|
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
* GNU General Public License for more details.
|
16 |
|
|
*
|
17 |
|
|
* You should have received a copy of the GNU General Public License
|
18 |
|
|
* along with Server Handling. See the file "COPYING". If not,
|
19 |
|
|
* write to: The Free Software Foundation, Inc.,
|
20 |
|
|
* 51 Franklin Street, Fifth Floor,
|
21 |
|
|
* Boston, MA 02110-1301, USA.
|
22 |
|
|
*
|
23 |
|
|
* As a special exception, The Free Software Foundation gives
|
24 |
|
|
* permission for additional uses of the text contained in his release
|
25 |
|
|
* of ServerHandler.
|
26 |
|
|
*
|
27 |
|
|
* The exception is that, if you link the ServerHandler library with other
|
28 |
|
|
* files to produce an executable, this does not by itself cause the
|
29 |
|
|
* resulting executable to be covered by the GNU General Public License.
|
30 |
|
|
* Your use of that executable is in no way restricted on account of
|
31 |
|
|
* linking the ServerHandler library code into it.
|
32 |
|
|
*
|
33 |
|
|
* This exception does not however invalidate any other reasons why
|
34 |
|
|
* the executable file might be covered by the GNU General Public License.
|
35 |
|
|
*
|
36 |
|
|
* This exception applies only to the code released by The Free
|
37 |
|
|
* Software Foundation under the name ServerHandler. If you copy code
|
38 |
|
|
* from other sources under the General Public License into a copy of
|
39 |
|
|
* ServerHandler, as the General Public License permits, the exception
|
40 |
|
|
* does not apply to the code that you add in this way. To avoid
|
41 |
|
|
* misleading anyone as to the status of such modified files, you must
|
42 |
|
|
* delete this exception notice from them.
|
43 |
|
|
*
|
44 |
|
|
* If you write modifications of your own for ServerHandler, it is your
|
45 |
|
|
* choice whether to permit this exception to apply to your modifications.
|
46 |
|
|
* If you do not wish that, delete this exception notice.
|
47 |
|
|
*/
|
48 |
|
|
|
49 |
|
|
#ifndef GCC_SERVER_H
|
50 |
|
|
#define GCC_SERVER_H
|
51 |
|
|
|
52 |
|
|
/*
|
53 |
|
|
* Dual pipe opening of a child process
|
54 |
|
|
*/
|
55 |
|
|
|
56 |
|
|
typedef struct
|
57 |
|
|
{
|
58 |
|
|
int read_fd;
|
59 |
|
|
int write_fd;
|
60 |
|
|
} t_fd_pair;
|
61 |
|
|
|
62 |
|
|
typedef struct
|
63 |
|
|
{
|
64 |
|
|
FILE *pf_read; /* parent read fp */
|
65 |
|
|
FILE *pf_write; /* parent write fp */
|
66 |
|
|
} t_pf_pair;
|
67 |
|
|
|
68 |
|
|
char* run_shell( const char* pzCmd );
|
69 |
|
|
pid_t proc2_fopen( t_pf_pair* p_pair, tCC** pp_args );
|
70 |
|
|
pid_t proc2_open( t_fd_pair* p_pair, tCC** pp_args );
|
71 |
|
|
int chain_open( int in_fd, tCC** pp_args, pid_t* p_child );
|
72 |
|
|
void close_server( void );
|
73 |
|
|
|
74 |
|
|
#endif /* ! GCC_SERVER_H */
|