1 //! getopt implementation for Redox, following http://pubs.opengroup.org/onlinepubs/009695399/functions/getopt.html 2 3 use core::ptr; 4 5 use crate::unix::header::getopt::getopt_long; 6 7 #[allow(non_upper_case_globals)] 8 #[no_mangle] 9 #[linkage = "weak"] // often redefined in GNU programs 10 pub static mut optarg: *mut ::c_char = ptr::null_mut(); 11 12 #[allow(non_upper_case_globals)] 13 #[no_mangle] 14 #[linkage = "weak"] // often redefined in GNU programs 15 pub static mut optind: ::c_int = 1; 16 17 #[allow(non_upper_case_globals)] 18 #[no_mangle] 19 #[linkage = "weak"] // often redefined in GNU programs 20 pub static mut opterr: ::c_int = 1; 21 22 #[allow(non_upper_case_globals)] 23 #[no_mangle] 24 #[linkage = "weak"] // often redefined in GNU programs 25 pub static mut optopt: ::c_int = -1; 26 27 #[no_mangle] 28 #[linkage = "weak"] // often redefined in GNU programs 29 pub unsafe extern "C" fn getopt( 30 argc: ::c_int, 31 argv: *const *mut ::c_char, 32 optstring: *const ::c_char, 33 ) -> ::c_int { 34 getopt_long(argc, argv, optstring, ptr::null(), ptr::null_mut()) 35 } 36