summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2022-11-30 00:02:38 +0000
committerDavid Carlier <devnexen@gmail.com>2022-12-01 12:34:38 +0000
commit27cc898f59e64579b51fae82a381c99566810e05 (patch)
treef4b5e49e623c4531fb314f0f358da2fb21aba071
parente4b8fd4f59a87346c870295c8125469c672998aa (diff)
downloadrust-libc-27cc898f59e64579b51fae82a381c99566810e05.tar.gz
adding getopt_long for unixes.
-rw-r--r--libc-test/build.rs8
-rw-r--r--libc-test/semver/android.txt3
-rw-r--r--libc-test/semver/apple.txt3
-rw-r--r--libc-test/semver/dragonfly.txt1
-rw-r--r--libc-test/semver/freebsd.txt1
-rw-r--r--libc-test/semver/linux.txt1
-rw-r--r--libc-test/semver/netbsd.txt1
-rw-r--r--libc-test/semver/openbsd.txt3
-rw-r--r--src/unix/bsd/mod.rs14
-rw-r--r--src/unix/haiku/mod.rs15
-rw-r--r--src/unix/linux_like/android/mod.rs14
-rw-r--r--src/unix/linux_like/linux/mod.rs14
-rw-r--r--src/unix/solarish/mod.rs15
13 files changed, 89 insertions, 4 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index a0e0380e61..f80a715dc1 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -199,6 +199,7 @@ fn test_apple(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
+ "getopt.h",
"glob.h",
"grp.h",
"iconv.h",
@@ -421,6 +422,7 @@ fn test_openbsd(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
+ "getopt.h",
"libgen.h",
"limits.h",
"link.h",
@@ -769,6 +771,7 @@ fn test_solarish(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
+ "getopt.h",
"glob.h",
"grp.h",
"ifaddrs.h",
@@ -997,6 +1000,7 @@ fn test_netbsd(target: &str) {
"elf.h",
"errno.h",
"fcntl.h",
+ "getopt.h",
"libgen.h",
"limits.h",
"link.h",
@@ -1208,6 +1212,7 @@ fn test_dragonflybsd(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
+ "getopt.h",
"glob.h",
"grp.h",
"ifaddrs.h",
@@ -1511,6 +1516,7 @@ fn test_android(target: &str) {
"elf.h",
"errno.h",
"fcntl.h",
+ "getopt.h",
"grp.h",
"ifaddrs.h",
"libgen.h",
@@ -1884,6 +1890,7 @@ fn test_freebsd(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
+ "getopt.h",
"glob.h",
"grp.h",
"iconv.h",
@@ -2803,6 +2810,7 @@ fn test_linux(target: &str) {
"dlfcn.h",
"elf.h",
"fcntl.h",
+ "getopt.h",
"glob.h",
[gnu]: "gnu/libc-version.h",
"grp.h",
diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt
index 1e914ae438..50979e5f81 100644
--- a/libc-test/semver/android.txt
+++ b/libc-test/semver/android.txt
@@ -3026,6 +3026,7 @@ getline
getlogin
getnameinfo
getopt
+getopt_long
getpeername
getpgid
getpgrp
@@ -3594,4 +3595,4 @@ wmemchr
write
writev
dirname
-basename \ No newline at end of file
+basename
diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt
index 95af36bbb4..329c8cdaac 100644
--- a/libc-test/semver/apple.txt
+++ b/libc-test/semver/apple.txt
@@ -1895,6 +1895,7 @@ getline
getloadavg
getmntinfo
getnameinfo
+getopt_long
getpeereid
getpriority
getprogname
@@ -2228,4 +2229,4 @@ waitid
xsw_usage
xucred
dirname
-basename \ No newline at end of file
+basename
diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt
index f8f0fa0891..8d0172c112 100644
--- a/libc-test/semver/dragonfly.txt
+++ b/libc-test/semver/dragonfly.txt
@@ -1294,6 +1294,7 @@ getlastlogx
getline
getloadavg
getnameinfo
+getopt_long
getpeereid
getpriority
getprogname
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index 8f73e027af..f11e1c5cc3 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -1599,6 +1599,7 @@ getline
getloadavg
getlocalbase
getnameinfo
+getopt_long
getpagesize
getpagesizes
getpeereid
diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt
index 54825c24bc..68bb3a0524 100644
--- a/libc-test/semver/linux.txt
+++ b/libc-test/semver/linux.txt
@@ -2967,6 +2967,7 @@ getifaddrs
getline
getmntent
getnameinfo
+getopt_long
getpriority
getpwent
getresgid
diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt
index b650a456e8..d6d519fd58 100644
--- a/libc-test/semver/netbsd.txt
+++ b/libc-test/semver/netbsd.txt
@@ -1254,6 +1254,7 @@ getlastlogx
getline
getloadavg
getnameinfo
+getopt_long
getpeereid
getpriority
getprogname
diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt
index d540671e1b..0dcd2b40c8 100644
--- a/libc-test/semver/openbsd.txt
+++ b/libc-test/semver/openbsd.txt
@@ -1040,6 +1040,7 @@ getline
getloadavg
getmntinfo
getnameinfo
+getopt_long
getpeereid
getpriority
getprogname
@@ -1232,4 +1233,4 @@ utrace
wait4
xucred
dirname
-basename \ No newline at end of file
+basename
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs
index 50177015a9..d49e3c4402 100644
--- a/src/unix/bsd/mod.rs
+++ b/src/unix/bsd/mod.rs
@@ -115,6 +115,13 @@ s! {
pub rm_so: regoff_t,
pub rm_eo: regoff_t,
}
+
+ pub struct option {
+ pub name: *const ::c_char,
+ pub has_arg: ::c_int,
+ pub flag: *mut ::c_int,
+ pub val: ::c_int,
+ }
}
s_no_extra_traits! {
@@ -885,6 +892,13 @@ extern "C" {
pub fn srand48(seed: ::c_long);
pub fn seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort;
pub fn lcong48(p: *mut ::c_ushort);
+ pub fn getopt_long(
+ argc: ::c_int,
+ argv: *const *mut c_char,
+ optstring: *const c_char,
+ longopts: *const option,
+ longindex: *mut ::c_int,
+ ) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index bb2e0351bf..005b1d9df5 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -430,6 +430,13 @@ s! {
pub key: *mut ::c_char,
pub data: *mut ::c_void,
}
+
+ pub struct option {
+ pub name: *const ::c_char,
+ pub has_arg: ::c_int,
+ pub flag: *mut ::c_int,
+ pub val: ::c_int,
+ }
}
s_no_extra_traits! {
@@ -1971,7 +1978,13 @@ extern "C" {
attr: *mut posix_spawnattr_t,
sigmask: *const ::sigset_t,
) -> ::c_int;
-
+ pub fn getopt_long(
+ argc: ::c_int,
+ argv: *const *mut c_char,
+ optstring: *const c_char,
+ longopts: *const option,
+ longindex: *mut ::c_int,
+ ) -> ::c_int;
}
#[link(name = "bsd")]
diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs
index 4c3dd4c88c..61885582aa 100644
--- a/src/unix/linux_like/android/mod.rs
+++ b/src/unix/linux_like/android/mod.rs
@@ -482,6 +482,13 @@ s! {
pub code: ::__u16,
pub absinfo: input_absinfo,
}
+
+ pub struct option {
+ pub name: *const ::c_char,
+ pub has_arg: ::c_int,
+ pub flag: *mut ::c_int,
+ pub val: ::c_int,
+ }
}
s_no_extra_traits! {
@@ -3471,6 +3478,13 @@ extern "C" {
pub fn dirname(path: *const ::c_char) -> *mut ::c_char;
pub fn basename(path: *const ::c_char) -> *mut ::c_char;
+ pub fn getopt_long(
+ argc: ::c_int,
+ argv: *const *mut c_char,
+ optstring: *const c_char,
+ longopts: *const option,
+ longindex: *mut ::c_int,
+ ) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index 6faf3ae04e..f0a0820c3d 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -618,6 +618,13 @@ s! {
pub ifr6_prefixlen: u32,
pub ifr6_ifindex: ::c_int,
}
+
+ pub struct option {
+ pub name: *const ::c_char,
+ pub has_arg: ::c_int,
+ pub flag: *mut ::c_int,
+ pub val: ::c_int,
+ }
}
s_no_extra_traits! {
@@ -4441,6 +4448,13 @@ extern "C" {
pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
+ pub fn getopt_long(
+ argc: ::c_int,
+ argv: *const *mut c_char,
+ optstring: *const c_char,
+ longopts: *const option,
+ longindex: *mut ::c_int,
+ ) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index 6b0557d359..abe304e8ea 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -466,6 +466,13 @@ s! {
pub pi_fputypes: [::c_char; PI_FPUTYPE as usize],
pub pi_clock: ::c_int,
}
+
+ pub struct option {
+ pub name: *const ::c_char,
+ pub has_arg: ::c_int,
+ pub flag: *mut ::c_int,
+ pub val: ::c_int,
+ }
}
s_no_extra_traits! {
@@ -3182,6 +3189,14 @@ extern "C" {
pub fn backtrace(buffer: *mut *mut ::c_void, size: ::c_int) -> ::c_int;
pub fn backtrace_symbols(buffer: *const *mut ::c_void, size: ::c_int) -> *mut *mut ::c_char;
pub fn backtrace_symbols_fd(buffer: *const *mut ::c_void, size: ::c_int, fd: ::c_int);
+
+ pub fn getopt_long(
+ argc: ::c_int,
+ argv: *const *mut c_char,
+ optstring: *const c_char,
+ longopts: *const option,
+ longindex: *mut ::c_int,
+ ) -> ::c_int;
}
#[link(name = "sendfile")]