aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/libghostty-vt/src/pty.c
blob: fe50d2b4beea39b1b7cb87e763fab4f1b845675d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#if defined(__FreeBSD__)

  #include <termios.h> // ioctl and constants
  #include <libutil.h> // openpty
  #include <stdlib.h> // ptsname_r
  #include <unistd.h> // tcgetpgrp

#elif defined(__linux__)

  #define _GNU_SOURCE // ptsname_r
  #include <pty.h> // openpty
  #include <stdlib.h> // ptsname_r
  #include <sys/ioctl.h> // ioctl and constants
  #include <unistd.h> // tcgetpgrp, setsid

#elif defined(__APPLE__)

  #include <sys/ioctl.h> // ioctl and constants
  #include <sys/ttycom.h>  // ioctl and constants for TIOCPTYGNAME
  #include <sys/types.h>
  #include <unistd.h> // tcgetpgrp
  #include <util.h> // openpty

  #ifndef tiocsctty
  #define tiocsctty 536900705
  #endif

  #ifndef tiocswinsz
  #define tiocswinsz 2148037735
  #endif

  #ifndef tiocgwinsz
  #define tiocgwinsz 1074295912
  #endif

#else

  #error "unsupported platform"

#endif