ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libptytty/src/c-api.C
Revision: 1.5
Committed: Mon Aug 25 13:33:46 2014 UTC (12 years ago) by sf-exg
Content type: text/plain
Branch: MAIN
CVS Tags: rel-1_8, rxvt-unicode-rel-9_26, rxvt-unicode-rel-9_25, rxvt-unicode-rel-9_22, rel-1_7, rxvt-unicode-rel-9_21
Changes since 1.4: +1 -1 lines
Log Message:
Revert last change.

File Contents

# User Rev Content
1 ayin 1.1 /*----------------------------------------------------------------------*
2     * File: c-api.C
3     *----------------------------------------------------------------------*
4     *
5     * All portions of code are copyright by their respective author/s.
6     * Copyright (c) 2005 Marc Lehmann <pcg@goof.com>
7     *
8     * This program is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License as published by
10 sf-exg 1.5 * the Free Software Foundation; either version 2 of the License, or
11 ayin 1.1 * (at your option) any later version.
12     *
13     * This program is distributed in the hope that it will be useful,
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     * GNU General Public License for more details.
17     *
18     * You should have received a copy of the GNU General Public License
19     * along with this program; if not, write to the Free Software
20     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21     *---------------------------------------------------------------------*/
22    
23 sf-exg 1.2 #include "config.h"
24 ayin 1.1
25     #include "ptytty.h"
26    
27     /////////////////////////////////////////////////////////////////////////////
28     // C API
29    
30     #ifndef PTYTTY_NO_C_API
31    
32     typedef void *PTYTTY;
33    
34     #define DEFINE_METHOD(retval, name, args1, args2) \
35     extern "C" retval ptytty_ ## name args1 \
36     { return ((struct ptytty *)ptytty)->name args2; }
37    
38     DEFINE_METHOD(int,pty,(PTYTTY ptytty),)
39     DEFINE_METHOD(int,tty,(PTYTTY ptytty),)
40     DEFINE_METHOD(int,get,(PTYTTY ptytty),())
41     DEFINE_METHOD(void,login,(PTYTTY ptytty, int cmd_pid, int login_shell, const char *hostname),(cmd_pid,login_shell,hostname))
42    
43     DEFINE_METHOD(void,close_tty,(PTYTTY ptytty),())
44     DEFINE_METHOD(int,make_controlling_tty,(PTYTTY ptytty),())
45     DEFINE_METHOD(void,set_utf8_mode,(PTYTTY ptytty, int on),(on))
46    
47     #define DEFINE_STATIC(retval, name, args) \
48     extern "C" retval ptytty_ ## name args \
49     { return ptytty::name args; }
50    
51     DEFINE_STATIC(void,drop_privileges,())
52     DEFINE_STATIC(void,use_helper,())
53     DEFINE_STATIC(void,sanitise_stdfd,())
54     DEFINE_STATIC(void,init,())
55    
56     DEFINE_STATIC(PTYTTY,create,())
57    
58     extern "C" void ptytty_delete (PTYTTY ptytty)
59     {
60     delete (struct ptytty *)ptytty;
61     }
62    
63     // send_fd, recv_fd not exposed
64    
65     #endif
66