1313
1414use crate :: Flag ;
1515
16- #[ cfg( not( bsd) ) ]
17- use nix:: sys:: termios:: BaudRate ;
18- use nix:: sys:: termios:: {
19- ControlFlags as C , InputFlags as I , LocalFlags as L , OutputFlags as O ,
20- SpecialCharacterIndices as S ,
16+ use rustix:: termios:: {
17+ ControlModes as C , InputModes as I , LocalModes as L , OutputModes as O , SpecialCodeIndex as S ,
2118} ;
2219
2320#[ derive( Debug ) ]
@@ -31,10 +28,7 @@ pub enum BaudType {
3128#[ derive( Debug ) ]
3229#[ cfg_attr( test, derive( PartialEq ) ) ]
3330pub enum AllFlags < ' a > {
34- #[ cfg( bsd) ]
3531 Baud ( u32 , BaudType ) ,
36- #[ cfg( not( bsd) ) ]
37- Baud ( BaudRate , BaudType ) ,
3832 ControlFlags ( ( & ' a Flag < C > , bool ) ) ,
3933 InputFlags ( ( & ' a Flag < I > , bool ) ) ,
4034 LocalFlags ( ( & ' a Flag < L > , bool ) ) ,
@@ -97,123 +91,85 @@ pub const OUTPUT_FLAGS: &[Flag<O>] = &[
9791 Flag :: new ( "onlcr" , O :: ONLCR ) . sane ( ) ,
9892 Flag :: new ( "onocr" , O :: ONOCR ) ,
9993 Flag :: new ( "onlret" , O :: ONLRET ) ,
100- #[ cfg( any(
101- target_vendor = "apple" ,
102- target_os = "android" ,
103- target_os = "haiku" ,
104- target_os = "linux"
105- ) ) ]
94+ #[ cfg( any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ) ]
10695 Flag :: new ( "ofdel" , O :: OFDEL ) ,
107- #[ cfg( any(
108- target_vendor = "apple" ,
109- target_os = "android" ,
110- target_os = "haiku" ,
111- target_os = "linux"
96+ #[ cfg( all(
97+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
98+ not( target_env = "musl" )
11299 ) ) ]
113100 Flag :: new_grouped ( "nl0" , O :: NL0 , O :: NLDLY ) . sane ( ) ,
114- #[ cfg( any(
115- target_vendor = "apple" ,
116- target_os = "android" ,
117- target_os = "haiku" ,
118- target_os = "linux"
101+ #[ cfg( all(
102+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
103+ not( target_env = "musl" )
119104 ) ) ]
120105 Flag :: new_grouped ( "nl1" , O :: NL1 , O :: NLDLY ) ,
121- #[ cfg( any(
122- target_vendor = "apple" ,
123- target_os = "android" ,
124- target_os = "haiku" ,
125- target_os = "linux"
106+ #[ cfg( all(
107+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
108+ not( target_env = "musl" )
126109 ) ) ]
127110 Flag :: new_grouped ( "cr0" , O :: CR0 , O :: CRDLY ) . sane ( ) ,
128- #[ cfg( any(
129- target_vendor = "apple" ,
130- target_os = "android" ,
131- target_os = "haiku" ,
132- target_os = "linux"
111+ #[ cfg( all(
112+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
113+ not( target_env = "musl" )
133114 ) ) ]
134115 Flag :: new_grouped ( "cr1" , O :: CR1 , O :: CRDLY ) ,
135- #[ cfg( any(
136- target_vendor = "apple" ,
137- target_os = "android" ,
138- target_os = "haiku" ,
139- target_os = "linux"
116+ #[ cfg( all(
117+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
118+ not( target_env = "musl" )
140119 ) ) ]
141120 Flag :: new_grouped ( "cr2" , O :: CR2 , O :: CRDLY ) ,
142- #[ cfg( any(
143- target_vendor = "apple" ,
144- target_os = "android" ,
145- target_os = "haiku" ,
146- target_os = "linux"
121+ #[ cfg( all(
122+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
123+ not( target_env = "musl" )
147124 ) ) ]
148125 Flag :: new_grouped ( "cr3" , O :: CR3 , O :: CRDLY ) ,
149- #[ cfg( any(
150- target_vendor = "apple" ,
151- target_os = "android" ,
152- target_os = "haiku" ,
153- target_os = "linux"
126+ #[ cfg( all(
127+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
128+ not( target_env = "musl" )
154129 ) ) ]
155- Flag :: new_grouped ( "tab0" , O :: TAB0 , O :: TABDLY ) . sane ( ) ,
156- #[ cfg( any(
157- target_vendor = "apple" ,
158- target_os = "android" ,
159- target_os = "haiku" ,
160- target_os = "linux"
130+ #[ cfg( all(
131+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
132+ not( target_env = "musl" )
161133 ) ) ]
162134 Flag :: new_grouped ( "tab1" , O :: TAB1 , O :: TABDLY ) ,
163- #[ cfg( any(
164- target_vendor = "apple" ,
165- target_os = "android" ,
166- target_os = "haiku" ,
167- target_os = "linux"
135+ #[ cfg( all(
136+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
137+ not( target_env = "musl" )
168138 ) ) ]
169139 Flag :: new_grouped ( "tab2" , O :: TAB2 , O :: TABDLY ) ,
170- #[ cfg( any(
171- target_vendor = "apple" ,
172- target_os = "android" ,
173- target_os = "haiku" ,
174- target_os = "linux"
140+ #[ cfg( all(
141+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
142+ not( target_env = "musl" )
175143 ) ) ]
176144 Flag :: new_grouped ( "tab3" , O :: TAB3 , O :: TABDLY ) ,
177- #[ cfg( any(
178- target_vendor = "apple" ,
179- target_os = "android" ,
180- target_os = "haiku" ,
181- target_os = "linux"
145+ #[ cfg( all(
146+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
147+ not( target_env = "musl" )
182148 ) ) ]
183149 Flag :: new_grouped ( "bs0" , O :: BS0 , O :: BSDLY ) . sane ( ) ,
184- #[ cfg( any(
185- target_vendor = "apple" ,
186- target_os = "android" ,
187- target_os = "haiku" ,
188- target_os = "linux"
150+ #[ cfg( all(
151+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
152+ not( target_env = "musl" )
189153 ) ) ]
190154 Flag :: new_grouped ( "bs1" , O :: BS1 , O :: BSDLY ) ,
191- #[ cfg( any(
192- target_vendor = "apple" ,
193- target_os = "android" ,
194- target_os = "haiku" ,
195- target_os = "linux"
155+ #[ cfg( all(
156+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
157+ not( target_env = "musl" )
196158 ) ) ]
197159 Flag :: new_grouped ( "vt0" , O :: VT0 , O :: VTDLY ) . sane ( ) ,
198- #[ cfg( any(
199- target_vendor = "apple" ,
200- target_os = "android" ,
201- target_os = "haiku" ,
202- target_os = "linux"
160+ #[ cfg( all(
161+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
162+ not( target_env = "musl" )
203163 ) ) ]
204164 Flag :: new_grouped ( "vt1" , O :: VT1 , O :: VTDLY ) ,
205- #[ cfg( any(
206- target_vendor = "apple" ,
207- target_os = "android" ,
208- target_os = "haiku" ,
209- target_os = "linux"
165+ #[ cfg( all(
166+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
167+ not( target_env = "musl" )
210168 ) ) ]
211169 Flag :: new_grouped ( "ff0" , O :: FF0 , O :: FFDLY ) . sane ( ) ,
212- #[ cfg( any(
213- target_vendor = "apple" ,
214- target_os = "android" ,
215- target_os = "haiku" ,
216- target_os = "linux"
170+ #[ cfg( all(
171+ any( target_os = "android" , target_os = "haiku" , target_os = "linux" ) ,
172+ not( target_env = "musl" )
217173 ) ) ]
218174 Flag :: new_grouped ( "ff1" , O :: FF1 , O :: FFDLY ) ,
219175] ;
@@ -249,77 +205,6 @@ pub const LOCAL_FLAGS: &[Flag<L>] = &[
249205 Flag :: new ( "extproc" , L :: EXTPROC ) ,
250206] ;
251207
252- // BSD's use u32 as baud rate, so using the enum is unnecessary.
253- #[ cfg( not( bsd) ) ]
254- pub const BAUD_RATES : & [ ( & str , BaudRate ) ] = & [
255- ( "0" , BaudRate :: B0 ) ,
256- ( "50" , BaudRate :: B50 ) ,
257- ( "75" , BaudRate :: B75 ) ,
258- ( "110" , BaudRate :: B110 ) ,
259- ( "134" , BaudRate :: B134 ) ,
260- ( "150" , BaudRate :: B150 ) ,
261- ( "200" , BaudRate :: B200 ) ,
262- ( "300" , BaudRate :: B300 ) ,
263- ( "600" , BaudRate :: B600 ) ,
264- ( "1200" , BaudRate :: B1200 ) ,
265- ( "1800" , BaudRate :: B1800 ) ,
266- ( "2400" , BaudRate :: B2400 ) ,
267- ( "4800" , BaudRate :: B4800 ) ,
268- ( "9600" , BaudRate :: B9600 ) ,
269- ( "19200" , BaudRate :: B19200 ) ,
270- ( "38400" , BaudRate :: B38400 ) ,
271- ( "57600" , BaudRate :: B57600 ) ,
272- ( "115200" , BaudRate :: B115200 ) ,
273- ( "230400" , BaudRate :: B230400 ) ,
274- // TODO: https://github.com/nix-rust/nix/pull/2815
275- #[ cfg( not( any(
276- target_os = "cygwin" ,
277- target_os = "fuchsia" ,
278- target_os = "hurd" ,
279- target_os = "redox"
280- ) ) ) ]
281- ( "460800" , BaudRate :: B460800 ) ,
282- #[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
283- ( "500000" , BaudRate :: B500000 ) ,
284- #[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
285- ( "576000" , BaudRate :: B576000 ) ,
286- // TODO: https://github.com/nix-rust/nix/pull/2815
287- #[ cfg( not( any(
288- target_os = "cygwin" ,
289- target_os = "fuchsia" ,
290- target_os = "hurd" ,
291- target_os = "redox"
292- ) ) ) ]
293- ( "921600" , BaudRate :: B921600 ) ,
294- #[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
295- ( "1000000" , BaudRate :: B1000000 ) ,
296- #[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
297- ( "1152000" , BaudRate :: B1152000 ) ,
298- #[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
299- ( "1500000" , BaudRate :: B1500000 ) ,
300- #[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
301- ( "2000000" , BaudRate :: B2000000 ) ,
302- #[ cfg( any(
303- target_os = "android" ,
304- all( target_os = "linux" , not( target_arch = "sparc64" ) )
305- ) ) ]
306- ( "2500000" , BaudRate :: B2500000 ) ,
307- #[ cfg( any(
308- target_os = "android" ,
309- all( target_os = "linux" , not( target_arch = "sparc64" ) )
310- ) ) ]
311- ( "3000000" , BaudRate :: B3000000 ) ,
312- #[ cfg( any(
313- target_os = "android" ,
314- all( target_os = "linux" , not( target_arch = "sparc64" ) )
315- ) ) ]
316- ( "3500000" , BaudRate :: B3500000 ) ,
317- #[ cfg( any(
318- target_os = "android" ,
319- all( target_os = "linux" , not( target_arch = "sparc64" ) )
320- ) ) ]
321- ( "4000000" , BaudRate :: B4000000 ) ,
322- ] ;
323208/// Control characters for the stty command.
324209///
325210/// This constant provides a mapping between the names of control characters
0 commit comments