]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/ttynam.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / ttynam.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: TTYNAM, system, terminal
7
8 .. _ttynam:
9
10 TTYNAM --- Get the name of a terminal device
11 ********************************************
12
13 .. function:: TTYNAM(UNIT)
14
15 Get the name of a terminal device. For more information,
16 see ``ttyname(3)``.
17
18 :param UNIT:
19 Shall be a scalar ``INTEGER``.
20
21 :param NAME:
22 Shall be of type ``CHARACTER``.
23
24 Standard:
25 GNU extension
26
27 Class:
28 Subroutine, function
29
30 Syntax:
31 .. code-block:: fortran
32
33 CALL TTYNAM(UNIT, NAME)
34 NAME = TTYNAM(UNIT)
35
36 Example:
37 .. code-block:: fortran
38
39 PROGRAM test_ttynam
40 INTEGER :: unit
41 DO unit = 1, 10
42 IF (isatty(unit=unit)) write(*,*) ttynam(unit)
43 END DO
44 END PROGRAM
45
46 See also:
47 :ref:`ISATTY`