1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: ptytty.c |
2 | * File: ptytty.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
6 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
|
|
7 | * Copyright (c) 2004 Marc Lehmann <pcg@goof.com> |
7 | * |
8 | * |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * 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 | * 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 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. |
12 | * (at your option) any later version. |
… | |
… | |
24 | |
25 | |
25 | /* |
26 | /* |
26 | * Try to be self-contained except for the above autoconfig'd defines |
27 | * Try to be self-contained except for the above autoconfig'd defines |
27 | */ |
28 | */ |
28 | |
29 | |
|
|
30 | #if 0 |
|
|
31 | #ifdef HAVE_GETPT |
|
|
32 | # define _GNU_SOURCE |
|
|
33 | #endif |
|
|
34 | #endif |
|
|
35 | |
29 | #include <stdio.h> |
36 | #include <cstdio> |
30 | #ifdef HAVE_STDLIB_H |
37 | #ifdef HAVE_STDLIB_H |
31 | # include <stdlib.h> |
38 | # include <cstdlib> |
32 | #endif |
39 | #endif |
33 | #ifdef HAVE_SYS_TYPES_H |
40 | #ifdef HAVE_SYS_TYPES_H |
34 | # include <sys/types.h> |
41 | # include <sys/types.h> |
35 | #endif |
42 | #endif |
36 | #ifdef HAVE_UNISTD_H |
43 | #ifdef HAVE_UNISTD_H |
37 | # include <unistd.h> |
44 | # include <unistd.h> |
38 | #endif |
45 | #endif |
39 | #if defined(HAVE_STRING_H) |
46 | #if defined(HAVE_STRING_H) |
40 | # include <string.h> |
47 | # include <cstring> |
41 | #endif |
48 | #endif |
42 | #ifdef HAVE_FCNTL_H |
49 | #ifdef HAVE_FCNTL_H |
43 | # include <fcntl.h> |
50 | # include <fcntl.h> |
44 | #endif |
51 | #endif |
45 | #ifdef HAVE_SYS_IOCTL_H |
52 | #ifdef HAVE_SYS_IOCTL_H |
46 | # include <sys/ioctl.h> |
53 | # include <sys/ioctl.h> |
47 | #endif |
54 | #endif |
48 | #if defined(PTYS_ARE_PTMX) && !defined(__CYGWIN32__) |
55 | #if defined(PTYS_ARE_PTMX) && !defined(__CYGWIN32__) |
49 | # include <sys/stropts.h> /* for I_PUSH */ |
56 | # include <sys/stropts.h> /* for I_PUSH */ |
|
|
57 | #endif |
|
|
58 | #ifdef HAVE_ISASTREAM |
|
|
59 | # include <stropts.h> |
50 | #endif |
60 | #endif |
51 | |
61 | |
52 | #ifdef DEBUG_TTY |
62 | #ifdef DEBUG_TTY |
53 | # define D_TTY(x) fprintf x ; fputc('\n', stderr) ; fflush(stderr) |
63 | # define D_TTY(x) fprintf x ; fputc('\n', stderr) ; fflush(stderr) |
54 | #else |
64 | #else |