Package org.jline.nativ
Class CLibrary
java.lang.Object
org.jline.nativ.CLibrary
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classtermios structure for termios functions, describing a general terminal interface that is provided to control asynchronous communications portsstatic classWindow sizes. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intstatic intstatic intstatic longstatic long -
Method Summary
Modifier and TypeMethodDescriptionstatic shortgetTerminalWidth(int fd) static intioctl(int filedes, long request, int[] params) Control a STREAMS device.static intioctl(int filedes, long request, CLibrary.WinSize params) static intisatty(int fd) test whether a file descriptor refers to a terminalstatic intopenpty(int[] amaster, int[] aslave, byte[] name, CLibrary.Termios termios, CLibrary.WinSize winsize) The openpty() function finds an available pseudoterminal and returns file descriptors for the master and slave in amaster and aslave.static intpollForInput(int fd, int timeoutMs) Polls a single file descriptor for input readability usingpoll(2).static inttcgetattr(int filedes, CLibrary.Termios termios) static inttcsetattr(int filedes, int optional_actions, CLibrary.Termios termios) static Stringttyname(int filedes)
-
Field Details
-
TCSANOW
public static int TCSANOW -
TCSADRAIN
public static int TCSADRAIN -
TCSAFLUSH
public static int TCSAFLUSH -
TIOCGWINSZ
public static long TIOCGWINSZ -
TIOCSWINSZ
public static long TIOCSWINSZ
-
-
Method Details
-
isatty
public static int isatty(int fd) test whether a file descriptor refers to a terminal- Parameters:
fd- file descriptor- Returns:
- isatty() returns 1 if fd is an open file descriptor referring to a terminal; otherwise 0 is returned, and errno is set to indicate the error
- See Also:
-
pollForInput
public static int pollForInput(int fd, int timeoutMs) Polls a single file descriptor for input readability usingpoll(2). Retries automatically onEINTR(signal interruption).- Parameters:
fd- file descriptor to poll (e.g.0for stdin)timeoutMs- timeout in milliseconds; 0 = immediate, −1 = infinite- Returns:
- positive if data is ready, 0 on timeout, −1 on permanent error
-
ttyname
-
openpty
public static int openpty(int[] amaster, int[] aslave, byte[] name, CLibrary.Termios termios, CLibrary.WinSize winsize) The openpty() function finds an available pseudoterminal and returns file descriptors for the master and slave in amaster and aslave.- Parameters:
amaster- master return valueaslave- slave return valuename- filename return valuetermios- optional pty attributeswinsize- optional size- Returns:
- 0 on success
- See Also:
-
tcgetattr
-
tcsetattr
-
ioctl
public static int ioctl(int filedes, long request, int[] params) Control a STREAMS device.- See Also:
-
ioctl
-
getTerminalWidth
public static short getTerminalWidth(int fd)
-