File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed
Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,10 @@ pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() }
4444 target_os = "freebsd" ,
4545 target_os = "dragonfly" ) ) ]
4646mod imp {
47- use core :: prelude:: * ;
47+ use prelude:: * ;
4848
49- use boxed:: Box ;
50- use vec:: Vec ;
51- use string:: String ;
5249 use mem;
50+ use slice;
5351
5452 use sync:: { StaticMutex , MUTEX_INIT } ;
5553
@@ -98,7 +96,12 @@ mod imp {
9896
9997 unsafe fn load_argc_and_argv ( argc : int , argv : * const * const u8 ) -> Vec < Vec < u8 > > {
10098 Vec :: from_fn ( argc as uint , |i| {
101- String :: from_raw_buf ( * argv. offset ( i as int ) ) . into_bytes ( )
99+ let arg = * argv. offset ( i as int ) ;
100+ let mut len = 0 u;
101+ while * arg. offset ( len as int ) != 0 {
102+ len += 1 u;
103+ }
104+ slice:: from_raw_buf ( & arg, len) . to_vec ( )
102105 } )
103106 }
104107
Original file line number Diff line number Diff line change 1+ // Copyright 2012-2014 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+
11+ use std:: io:: Command ;
12+ use std:: os;
13+
14+ fn main ( ) {
15+ if os:: args ( ) . len ( ) == 1 {
16+ assert ! ( Command :: new( os:: self_exe_name( ) . unwrap( ) ) . arg( b"\xff " )
17+ . status( ) . unwrap( ) . success( ) )
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments