1
- use super :: { WORD_SIZE , abi} ;
2
1
use crate :: ffi:: OsString ;
3
2
use crate :: fmt;
4
- use crate :: sys:: os_str;
5
- use crate :: sys_common:: FromInner ;
6
3
7
4
pub struct Args {
8
5
i_forward : usize ,
@@ -11,30 +8,13 @@ pub struct Args {
11
8
}
12
9
13
10
pub fn args ( ) -> Args {
14
- let count = unsafe { abi:: sys_argc ( ) } ;
15
- Args { i_forward : 0 , i_back : 0 , count }
11
+ Args { i_forward : 0 , i_back : 0 , count : 0 }
16
12
}
17
13
18
14
impl Args {
19
- /// Use sys_argv to get the arg at the requested index. Does not check that i is less than argc
20
- /// and will not return if the index is out of bounds.
21
- fn argv ( i : usize ) -> OsString {
22
- let arg_len = unsafe { abi:: sys_argv ( crate :: ptr:: null_mut ( ) , 0 , i) } ;
23
-
24
- let arg_len_words = ( arg_len + WORD_SIZE - 1 ) / WORD_SIZE ;
25
- let words = unsafe { abi:: sys_alloc_words ( arg_len_words) } ;
26
-
27
- let arg_len2 = unsafe { abi:: sys_argv ( words, arg_len_words, i) } ;
28
- debug_assert_eq ! ( arg_len, arg_len2) ;
29
-
30
- // Convert to OsString.
31
- //
32
- // FIXME: We can probably get rid of the extra copy here if we
33
- // reimplement "os_str" instead of just using the generic unix
34
- // "os_str".
35
- let arg_bytes: & [ u8 ] =
36
- unsafe { crate :: slice:: from_raw_parts ( words. cast ( ) as * const u8 , arg_len) } ;
37
- OsString :: from_inner ( os_str:: Buf { inner : arg_bytes. to_vec ( ) } )
15
+ /// Args::argv is currently not implemented.
16
+ fn argv ( _i : usize ) -> OsString {
17
+ panic ! ( "Args::argv is currently not implemented" ) ;
38
18
}
39
19
}
40
20
0 commit comments