Merge branch 'getopt-cleanup' into 'master'

getopt cleanup

See merge request redox-os/relibc!855
This commit is contained in:
Jeremy Soller
2026-01-02 06:33:33 -07:00
2 changed files with 16 additions and 4 deletions
+9 -2
View File
@@ -1,4 +1,6 @@
//! getopt implementation for relibc
//! `getopt` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getopt.html>.
#![deny(unsafe_op_in_unsafe_fn)]
@@ -7,7 +9,7 @@ use crate::{
stdio, string,
unistd::{optarg, opterr, optind, optopt},
},
platform::types::*,
platform::types::{c_char, c_int, size_t},
};
use core::ptr;
@@ -25,6 +27,11 @@ pub struct option {
val: c_int,
}
/// See <https://www.man7.org/linux/man-pages/man3/getopt.3.html>.
///
/// Non-POSIX.
///
/// Functions the same as `getopt` but also accepts long options.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn getopt_long(
argc: c_int,
+7 -2
View File
@@ -1,8 +1,13 @@
//! getopt implementation for Redox, following http://pubs.opengroup.org/onlinepubs/009695399/functions/getopt.html
//! `getopt` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getopt.html>.
use core::ptr;
use crate::{header::getopt, platform::types::*};
use crate::{
header::getopt,
platform::types::{c_char, c_int},
};
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getopt.html>.
#[allow(non_upper_case_globals)]