ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libptytty/src/c-api.C
Revision: 1.8
Committed: Wed Jun 16 05:12:47 2021 UTC (2 years, 11 months ago) by sf-exg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +78 -27 lines
Log Message:
Remove macro layer to define C functions

File Contents

# Content
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 * the Free Software Foundation; either version 2 of the License, or
11 * (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 #include "config.h"
24
25 #include "ptytty.h"
26
27 /////////////////////////////////////////////////////////////////////////////
28 // C API
29
30 #if PTYTTY_C_API
31
32 typedef void *PTYTTY;
33
34 extern "C"
35 {
36 int
37 ptytty_pty (PTYTTY ptytty)
38 {
39 return ((struct ptytty *)ptytty)->pty;
40 }
41
42 int
43 ptytty_tty (PTYTTY ptytty)
44 {
45 return ((struct ptytty *)ptytty)->tty;
46 }
47
48 int
49 ptytty_get (PTYTTY ptytty)
50 {
51 return ((struct ptytty *)ptytty)->get ();
52 }
53
54 void
55 ptytty_login (PTYTTY ptytty, int cmd_pid, int login_shell, const char *hostname)
56 {
57 return ((struct ptytty *)ptytty)->login (cmd_pid, login_shell, hostname);
58 }
59
60 void
61 ptytty_close_tty (PTYTTY ptytty)
62 {
63 return ((struct ptytty *)ptytty)->close_tty ();
64 }
65
66 int
67 ptytty_make_controlling_tty (PTYTTY ptytty)
68 {
69 return ((struct ptytty *)ptytty)->make_controlling_tty ();
70 }
71
72 void
73 ptytty_set_utf8_mode (PTYTTY ptytty, int on)
74 {
75 return ((struct ptytty *)ptytty)->set_utf8_mode (on);
76 }
77
78 void
79 ptytty_sanitise_stdfd ()
80 {
81 return ptytty::sanitise_stdfd ();
82 }
83
84 void
85 ptytty_init ()
86 {
87 return ptytty::init ();
88 }
89
90 PTYTTY
91 ptytty_create ()
92 {
93 return ptytty::create ();
94 }
95
96 void
97 ptytty_delete (PTYTTY ptytty)
98 {
99 delete (struct ptytty *)ptytty;
100 }
101
102 void
103 ptytty_drop_privileges ()
104 {
105 return ptytty::drop_privileges ();
106 }
107
108 #if PTYTTY_HELPER
109 void
110 ptytty_use_helper ()
111 {
112 return ptytty::use_helper ();
113 }
114 #endif
115 }
116
117 // send_fd, recv_fd not exposed
118
119 #endif