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. |
… | |
… | |
30 | #ifdef HAVE_GETPT |
31 | #ifdef HAVE_GETPT |
31 | # define _GNU_SOURCE |
32 | # define _GNU_SOURCE |
32 | #endif |
33 | #endif |
33 | #endif |
34 | #endif |
34 | |
35 | |
35 | #include <stdio.h> |
36 | #include <cstdio> |
36 | #ifdef HAVE_STDLIB_H |
37 | #ifdef HAVE_STDLIB_H |
37 | # include <stdlib.h> |
38 | # include <cstdlib> |
38 | #endif |
39 | #endif |
39 | #ifdef HAVE_SYS_TYPES_H |
40 | #ifdef HAVE_SYS_TYPES_H |
40 | # include <sys/types.h> |
41 | # include <sys/types.h> |
41 | #endif |
42 | #endif |
42 | #ifdef HAVE_UNISTD_H |
43 | #ifdef HAVE_UNISTD_H |
43 | # include <unistd.h> |
44 | # include <unistd.h> |
44 | #endif |
45 | #endif |
45 | #if defined(HAVE_STRING_H) |
46 | #if defined(HAVE_STRING_H) |
46 | # include <string.h> |
47 | # include <cstring> |
47 | #endif |
48 | #endif |
48 | #ifdef HAVE_FCNTL_H |
49 | #ifdef HAVE_FCNTL_H |
49 | # include <fcntl.h> |
50 | # include <fcntl.h> |
50 | #endif |
51 | #endif |
51 | #ifdef HAVE_SYS_IOCTL_H |
52 | #ifdef HAVE_SYS_IOCTL_H |
52 | # include <sys/ioctl.h> |
53 | # include <sys/ioctl.h> |
53 | #endif |
54 | #endif |
54 | #if defined(PTYS_ARE_PTMX) && !defined(__CYGWIN32__) |
55 | #if defined(PTYS_ARE_PTMX) && defined(HAVE_SYS_STROPTS_H) |
55 | # 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> |
56 | #endif |
60 | #endif |
57 | |
61 | |
58 | #ifdef DEBUG_TTY |
62 | #ifdef DEBUG_TTY |
59 | # define D_TTY(x) fprintf x ; fputc('\n', stderr) ; fflush(stderr) |
63 | # define D_TTY(x) fprintf x ; fputc('\n', stderr) ; fflush(stderr) |
60 | #else |
64 | #else |