| 1 |
|
| #include "EXTERN.h" |
| 2 |
|
| #include "perl.h" |
| 3 |
|
| #include "XSUB.h" |
| 4 |
|
| |
| 5 |
|
| #include <pty.h> |
| 6 |
|
| #include <utmp.h> |
| 7 |
|
| |
| 8 |
|
| |
| 9 |
|
| MODULE = IO::Tty::Util PACKAGE = IO::Tty::Util |
| 10 |
|
| |
| 11 |
|
| PROTOTYPES: DISABLE |
| 12 |
|
| |
| 13 |
|
| |
| 14 |
|
| |
| 15 |
|
| # int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp); |
| 16 |
|
| void _openpty(rows, cols) |
| 17 |
|
| int rows |
| 18 |
|
| int cols |
| 19 |
|
| |
| 20 |
|
| PREINIT: |
| 21 |
|
| int amaster ; |
| 22 |
|
| int aslave ; |
| 23 |
|
| int rc ; |
| 24 |
|
| struct winsize win ; |
| 25 |
|
| |
| 26 |
|
| PPCODE: |
| 27 |
5 |
| win.ws_row = rows ; |
| 28 |
5 |
| win.ws_col = cols ; |
| 29 |
5 |
| rc = openpty(&amaster, &aslave, NULL, NULL, &win) ; |
| 30 |
5 |
▶ | if (rc == -1){ |
Branch: 1 branch
| Branch | True | False | Total |
| if (rc == -1){ |
0 |
5 |
5 |
|
| 31 |
0 |
▶ | XPUSHs(&PL_sv_undef) ; |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef) ; |
0 |
0 |
0 |
|
| 32 |
|
| } |
| 33 |
|
| else { |
| 34 |
5 |
▶ | XPUSHs(sv_2mortal(newSVnv(amaster))) ; |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVnv(amaster))) ; |
0 |
5 |
5 |
|
| 35 |
5 |
▶ | XPUSHs(sv_2mortal(newSVnv(aslave))) ; |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVnv(aslave))) ; |
0 |
5 |
5 |
|
| 36 |
|
| } |
| 37 |
|
| |
| 38 |
|
| |
| 39 |
|
| |
| 40 |
|
| # int login_tty(int fd); |
| 41 |
|
| void _login_tty(fd) |
| 42 |
|
| int fd |
| 43 |
|
| |
| 44 |
|
| PPCODE: |
| 45 |
2 |
▶ | XPUSHs(sv_2mortal(newSVnv(login_tty(fd)))) ; |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVnv(login_tty(fd)))) ; |
0 |
2 |
2 |
|
| 46 |
|
| |