1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 #include "aix-termios.h"
24 tcgetattr (fd
, linuxtermios_p
)
26 struct termios
*linuxtermios_p
;
28 struct aixtermios aixtermios
;
31 result
= /* make syscall */;
35 /* Convert the result. */
37 linuxtermios_p
->c_cc
[VINTR
] = aixtermios
.c_cc
[AIX_VINTR
];
38 linuxtermios_p
->c_cc
[VQUIT
] = aixtermios
.c_cc
[AIX_VQUIT
];
39 linuxtermios_p
->c_cc
[VERASE
] = aixtermios
.c_cc
[AIX_VERASE
];
40 linuxtermios_p
->c_cc
[VKILL
] = aixtermios
.c_cc
[AIX_VKILL
];
41 linuxtermios_p
->c_cc
[VEOF
] = aixtermios
.c_cc
[AIX_VEOF
];
42 // XXX VMIN has the same value as VEOF !?
43 linuxtermios_p
->c_cc
[VEOL
] = aixtermios
.c_cc
[AIX_VEOL
];
44 // XXX VTIME has the same value as VEOL !?
45 linuxtermios_p
->c_cc
[VEOL2
] = aixtermios
.c_cc
[AIX_VEOL2
];
46 linuxtermios_p
->c_cc
[VSTART
] = aixtermios
.c_cc
[AIX_VSTART
];
47 linuxtermios_p
->c_cc
[VSTOP
] = aixtermios
.c_cc
[AIX_VSTOP
];
48 linuxtermios_p
->c_cc
[VSUSP
] = aixtermios
.c_cc
[AIX_VSUSP
];
49 // XXX No Linux equivalent for VDSUSP !?
50 linuxtermios_p
->c_cc
[VREPRINT
] = aixtermios
.c_cc
[AIX_VREPRINT
];
51 linuxtermios_p
->c_cc
[VDISCARD
] = aixtermios
.c_cc
[AIX_VDISCARD
];
52 linuxtermios_p
->c_cc
[VWERASE
] = aixtermios
.c_cc
[AIX_VWERASE
];
53 linuxtermios_p
->c_cc
[VLNEXT
] = aixtermios
.c_cc
[AIX_VLNEXT
];
55 linuxtermios_p
->c_cflag
= aixtermios
.c_c_flag
& AIX_CBAUD
;
57 /* Only the IUCLC, IXANY, and IMAXBEL values are different in the
59 linuxtermios_p
->c_iflag
= aixtermios
.c_iflag
& 0x7ff;
60 if (aixtermios
.c_iflag
& AIX_IXANY
)
61 linuxtermios_p
->c_iflag
|= IXANY
;
62 if (aixtermios
.c_iflag
& AIX_IUCLC
)
63 linuxtermios_p
->c_iflag
|= IUCLC
;
64 if (aixtermios
.c_iflag
& AIX_IMAXBEL
)
65 linuxtermios_p
->c_iflag
|= IMAXBEL
;
67 /* Many of the c_oflag files differ. Bummer. */
68 linuxtermios_p
->c_oflag
= (aixtermios
.c_oflag
69 & (OPOST
| OCRNL
| ONOCR
| ONLRET
| OFILL
71 if (aixtermios
.c_oflag
& AIX_OLCUC
)
72 linuxtermios_p
->c_oflag
|= OLCUC
;
73 if (aixtermios
.c_oflag
& AIX_ONLCR
)
74 linuxtermios_p
->c_oflag
|= ONLCR
;
75 if (aixtermiosc_oflag
& AIX_NLDLY
)
76 linuxtermios_p
->c_oflag
|= NL1
;
78 if (aixtermiosc_oflag
.c_oflag
& AIX_TABDLY
)
81 #if AIX_TAB1 << offset != TAB1 || AIX_TAB3 << offset != TAB3
82 # error "Check the offset"
84 linuxtermios_p
->c_oflag
|= (aixtermios
.c_oflag
>> offset
) & TABDLY
;
87 if (aixtermios
.c_oflag
& AIX_FFDLY
)
88 linuxtermios_p
->c_oflag
|= FF1
;
89 if (aixtermios
.c_oflag
& AIX_BSDLY
)
90 linuxtermios_p
->c_oflag
|= BS1
;
91 if (aixtermios
.c_oflag
& AIX_VTDLY
)
92 linuxtermios_p
->c_oflag
|= VT1
;
94 /* A lot of the c_cflag member is also different. */
95 if (aixtermios
.c_cflag
& AIX_CSIZE
)
98 #if CSIZE >> offset != AIX_CSIZE
99 # error "Check the offset"
101 linuxtermios_p
->c_cflag
|= (aixtermios
.c_cflag
>> offset
) & CSIZE
;
105 if (aixtermios
.c_cflag
& AIX_STOPB
)
106 linuxtermios_p
->c_cflag
|= STOPB
;
107 if (aixtermios
.c_cflag
& AIX_CREAD
)
108 linuxtermios_p
->c_cflag
|= CREAD
;
109 if (aixtermios
.cflag
& AIX_PARENB
)
110 linuxtermios_p
->c_cflag
|= PARENB
;
111 if (aixtermios
.cflag
& AIX_PARODD
)
112 linuxtermios_p
->c_cflag
|= PARODD
;
113 if (aixtermios
.c_cflag
& AIX_HUPCL
)
114 linuxtermios_p
->c_cflag
|= HUPCL
;
115 if (aixtermios
.c_cflag
& AIX_CLOCAL
)
116 linuxtermios_p
->c_cflag
|= CLOCAL
;
118 /* The c_lflag is information is also different. */
119 aixtermios
.c_lflag
= 0;
120 if (aixtermios
.c_lflag
& AIX_ISIG
)
121 linuxtermios_p
->c_lflag
|= ISIG
;
122 if (aixtermios
.c_lflag
& AIX_ICANON
)
123 linuxtermios_p
->c_lflag
|= ICANON
;
124 if (aixtermios
.c_lflag
& AIX_XCASE
)
125 linuxtermios_p
->c_lflag
|= XCASE
;
126 if (aixtermios
.c_lflag
& AIX_ECHO
)
127 linuxtermios_p
->c_lflag
|= ECHO
;
128 if (aixtermios
.c_lflag
& AIX_ECHOE
)
129 linuxtermios_p
->c_lflag
|= ECHOE
;
130 if (aixtermios
.c_lflag
& AIX_ECHOK
)
131 linuxtermios_p
->c_lflag
|= ECHOK
;
132 if (aixtermios
.c_lflag
& AIX_ECHONL
)
133 linuxtermios_p
->c_lflag
|= ECHONL
;
134 if (aixtermios
.c_lflag
& AIX_NOFLSH
)
135 linuxtermios_p
->c_lflag
|= NOFLSH
;
136 if (aixtermios
.c_lflag
& AIX_TOSTOP
)
137 linuxtermios_p
->c_lflag
|= TOSTOP
;
138 if (aixtermios
.c_lflag
& AIX_ECHOCTL
)
139 linuxtermios_p
->c_lflag
|= ECHOCTL
;
140 if (aixtermios
.c_lflag
& AIX_ECHOPRT
)
141 linuxtermios_p
->c_lflag
|= ECHOPRT
;
142 if (aixtermios
.c_lflag
& AIX_ECHOKE
)
143 linuxtermios_p
->c_lflag
|= ECHOKE
;
144 if (aixtermios
.c_lflag
& AIX_FLUSHO
)
145 linuxtermios_p
->c_lflag
|= FLUSHO
;
146 if (aixtermios
.c_lflag
& AIX_PENDIN
)
147 linuxtermios_p
->c_lflag
|= PENDIN
;
148 if (aixtermios
->c_lflag
& AIX_IEXTEN
)
149 linuxtermios_p
->c_lflag
|= IEXTEN
;
152 // Convert error here or in syscall.