tools/toollib: remove from main Makefile.in
[AROS.git] / compiler / posixc / tcgetattr.c
blobed56470b7981348b2b17af699391cc555a66c015
1 /*
2 Copyright © 2016, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/dos.h>
8 #include "__fdesc.h"
10 /*****************************************************************************
12 NAME */
14 #include <sys/ioctl.h>
15 #include <termios.h>
16 #include <errno.h>
18 int tcgetattr(
20 /* SYNOPSIS */
21 int fd,
22 struct termios *t)
24 /* FUNCTION
25 Get terminal attributes.
27 INPUTS
28 fd - file descriptor
29 t - struct termios where attributes are put
31 RESULT
32 0 - success
33 -1 - error
35 NOTES
36 Currently supports only ICANON flag
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 ioctl()
45 INTERNALS
47 ******************************************************************************/
49 fdesc *fdesc = __getfdesc(fd);
51 if (!fdesc)
53 errno = EBADF;
54 return -1;
57 if (fdesc->fcb->privflags & _FCB_CONSOLERAW)
58 t->c_lflag &= ~ICANON;
59 else
60 t->c_lflag |= ICANON;
62 return 0;