1
+ // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
1
11
/// ncurses-compatible compiled terminfo format parsing (term(5))
2
12
3
13
use core:: prelude:: * ;
@@ -283,11 +293,12 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
283
293
284
294
285
295
// Find the offset of the NUL we want to go to
286
- let nulpos = vec:: position_between ( string_table, offset as uint , string_table_bytes as uint ,
287
- |& b| b == 0 ) ;
296
+ let nulpos = vec:: position_between ( string_table, offset as uint ,
297
+ string_table_bytes as uint , |& b| b == 0 ) ;
288
298
match nulpos {
289
299
Some ( x) => {
290
- string_map. insert ( name. to_owned ( ) , string_table. slice ( offset as uint , x) . to_owned ( ) )
300
+ string_map. insert ( name. to_owned ( ) ,
301
+ string_table. slice ( offset as uint , x) . to_owned ( ) )
291
302
} ,
292
303
None => {
293
304
return Err ( ~"invalid file: missing NUL in string_table") ;
@@ -303,7 +314,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
303
314
#[ cfg( test) ]
304
315
mod test {
305
316
use super :: * ;
306
- use p = std:: path:: PosixPath ;
317
+ use p = std:: path:: Path ;
307
318
308
319
#[ test]
309
320
fn test_veclens ( ) {
@@ -314,6 +325,7 @@ mod test {
314
325
315
326
#[ test]
316
327
fn test_parse ( ) {
317
- parse ( io:: file_reader ( & p ( "/usr/share/terminfo/r/rxvt-256color" ) ) . unwrap ( ) , false ) ;
328
+ // FIXME #6870: Distribute a compiled file in src/tests and test there
329
+ // parse(io::file_reader(&p("/usr/share/terminfo/r/rxvt-256color")).unwrap(), false);
318
330
}
319
331
}
0 commit comments