1 ------------------------------------------------------------------------------
3 -- GNAT LIBRARY COMPONENTS --
9 -- Copyright (C) 2002-2023, AdaCore --
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. --
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. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This package provides control over pseudo terminals (ttys)
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.
43 type TTY_Handle
is private;
44 -- Handle for a tty descriptor
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.
50 procedure Allocate_TTY
(Handle
: out TTY_Handle
);
53 procedure Reset_TTY
(Handle
: TTY_Handle
);
54 -- Reset settings of a given tty
56 procedure Close_TTY
(Handle
: in out TTY_Handle
);
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"
63 function TTY_Descriptor
64 (Handle
: TTY_Handle
) return GNAT
.OS_Lib
.File_Descriptor
;
65 -- Return the low level descriptor associated with Handle
69 type TTY_Handle
is record
70 Handle
: System
.Address
:= System
.Null_Address
;