File tree 2 files changed +27
-5
lines changed
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() }
44
44
target_os = "freebsd" ,
45
45
target_os = "dragonfly" ) ) ]
46
46
mod imp {
47
- use core :: prelude:: * ;
47
+ use prelude:: * ;
48
48
49
- use boxed:: Box ;
50
- use vec:: Vec ;
51
- use string:: String ;
52
49
use mem;
50
+ use slice;
53
51
54
52
use sync:: { StaticMutex , MUTEX_INIT } ;
55
53
@@ -98,7 +96,12 @@ mod imp {
98
96
99
97
unsafe fn load_argc_and_argv ( argc : int , argv : * const * const u8 ) -> Vec < Vec < u8 > > {
100
98
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 ( )
102
105
} )
103
106
}
104
107
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