2
0

getopt.rs 1.0 KB

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