| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT LIBRARY COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- G N A T . T T Y -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 2002-2025, AdaCore -- |
| 10 |
-- -- |
| 11 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 12 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 13 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 14 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 15 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 16 |
-- or FITNESS FOR A PARTICULAR PURPOSE. -- |
| 17 |
-- -- |
| 18 |
-- As a special exception under Section 7 of GPL version 3, you are granted -- |
| 19 |
-- additional permissions described in the GCC Runtime Library Exception, -- |
| 20 |
-- version 3.1, as published by the Free Software Foundation. -- |
| 21 |
-- -- |
| 22 |
-- You should have received a copy of the GNU General Public License and -- |
| 23 |
-- a copy of the GCC Runtime Library Exception along with this program; -- |
| 24 |
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- |
| 25 |
-- <http://www.gnu.org/licenses/>. -- |
| 26 |
-- -- |
| 27 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 28 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 29 |
-- -- |
| 30 |
------------------------------------------------------------------------------ |
| 31 |
|
| 32 |
-- This package provides control over pseudo terminals (ttys) |
| 33 |
|
| 34 |
-- This package is only supported on unix systems. See function TTY_Supported |
| 35 |
-- to test dynamically whether other functions of this package can be called. |
| 36 |
|
| 37 |
with System; |
| 38 |
|
| 39 |
with GNAT.OS_Lib; |
| 40 |
|
| 41 |
package GNAT.TTY is |
| 42 |
|
| 43 |
type TTY_Handle is private; |
| 44 |
-- Handle for a tty descriptor |
| 45 |
|
| 46 |
function TTY_Supported return Boolean; |
| 47 |
-- If True, the other functions of this package can be called. Otherwise, |
| 48 |
-- all functions in this package will raise Program_Error if called. |
| 49 |
|
| 50 |
procedure Allocate_TTY (Handle : out TTY_Handle); |
| 51 |
-- Allocate a new tty |
| 52 |
|
| 53 |
procedure Reset_TTY (Handle : TTY_Handle); |
| 54 |
-- Reset settings of a given tty |
| 55 |
|
| 56 |
procedure Close_TTY (Handle : in out TTY_Handle); |
| 57 |
-- Close a given tty |
| 58 |
|
| 59 |
function TTY_Name (Handle : TTY_Handle) return String; |
| 60 |
-- Return the external name of a tty. The name depends on the tty handling |
| 61 |
-- on the given target. It will typically look like: "/dev/ptya1" |
| 62 |
|
| 63 |
function TTY_Descriptor |
| 64 |
(Handle : TTY_Handle) return GNAT.OS_Lib.File_Descriptor; |
| 65 |
-- Return the low level descriptor associated with Handle |
| 66 |
|
| 67 |
private |
| 68 |
|
| 69 |
type TTY_Handle is record |
| 70 |
Handle : System.Address := System.Null_Address; |
| 71 |
end record; |
| 72 |
|
| 73 |
end GNAT.TTY; |