From f1a8aeb7f07c71a0e4304d2d92e1375721ede287 Mon Sep 17 00:00:00 2001 From: mengfansheng Date: Mon, 27 May 2024 10:06:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20r=5Fgeneral?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utshell-0.5/r_general/Cargo.toml | 15 +++++ utshell-0.5/r_general/src/lib.rs | 104 +++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 utshell-0.5/r_general/Cargo.toml create mode 100644 utshell-0.5/r_general/src/lib.rs diff --git a/utshell-0.5/r_general/Cargo.toml b/utshell-0.5/r_general/Cargo.toml new file mode 100644 index 00000000..c21cfff1 --- /dev/null +++ b/utshell-0.5/r_general/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "r_general" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +libc = "*" +rcommon = {path = "../builtins_rust/common"} +r_bash = {path = "../r_bash"} + +[lib] +name = "r_general" +crate-type = ["staticlib","rlib"] \ No newline at end of file diff --git a/utshell-0.5/r_general/src/lib.rs b/utshell-0.5/r_general/src/lib.rs new file mode 100644 index 00000000..b43c6439 --- /dev/null +++ b/utshell-0.5/r_general/src/lib.rs @@ -0,0 +1,104 @@ +//# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. + +//# SPDX-License-Identifier: GPL-3.0-or-later + +#![allow( + dead_code, + mutable_transmutes, + non_camel_case_types, + non_snake_case, + non_upper_case_globals, + unused_assignments, + unused_mut +)] +use libc::FILE; +extern "C" { + fn __strtol_internal( + __nptr: *const libc::c_char, + __endptr: *mut *mut libc::c_char, + __base: libc::c_int, + __group: libc::c_int, + ) -> libc::c_long; + fn __xstat( + __ver: libc::c_int, + __filename: *const libc::c_char, + __stat_buf: *mut stat, + ) -> libc::c_int; + fn lseek(__fd: libc::c_int, __offset: __off_t, __whence: libc::c_int) -> __off_t; + fn close(__fd: libc::c_int) -> libc::c_int; + fn pipe(__pipedes: *mut libc::c_int) -> libc::c_int; + fn dup2(__fd: libc::c_int, __fd2: libc::c_int) -> libc::c_int; + fn confstr(__name: libc::c_int, __buf: *mut libc::c_char, __len: size_t) -> size_t; + fn getgroups(__size: libc::c_int, __list: *mut __gid_t) -> libc::c_int; + fn ttyname(__fd: libc::c_int) -> *mut libc::c_char; + fn getdtablesize() -> libc::c_int; + fn fcntl(__fd: libc::c_int, __cmd: libc::c_int, _: ...) -> libc::c_int; + fn open(__file: *const libc::c_char, __oflag: libc::c_int, _: ...) -> libc::c_int; + fn strtol(_: *const libc::c_char, _: *mut *mut libc::c_char, _: libc::c_int) -> libc::c_long; + fn strlen(_: *const libc::c_char) -> libc::c_ulong; + fn strrchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; + fn memmove(_: *mut libc::c_void, _: *const libc::c_void, _: libc::c_ulong) + -> *mut libc::c_void; + fn strncmp(_: *const libc::c_char, _: *const libc::c_char, _: libc::c_ulong) -> libc::c_int; + fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int; + fn strncpy(_: *mut libc::c_char, _: *const libc::c_char, _: libc::c_ulong) + -> *mut libc::c_char; + fn strcpy(_: *mut libc::c_char, _: *const libc::c_char) -> *mut libc::c_char; + static mut stdin: *mut FILE; + static mut stderr: *mut FILE; + fn printf(_: *const libc::c_char, _: ...) -> libc::c_int; + fn fileno(__stream: *mut FILE) -> libc::c_int; + fn __ctype_b_loc() -> *mut *const libc::c_ushort; + fn __errno_location() -> *mut libc::c_int; + fn dcgettext( + __domainname: *const libc::c_char, + __msgid: *const libc::c_char, + __category: libc::c_int, + ) -> *mut libc::c_char; + static mut sh_syntaxtab: [libc::c_int; 0]; + static mut interactive_shell: libc::c_int; + static mut inherit_errexit: libc::c_int; + static mut posixly_correct: libc::c_int; + fn mbschr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; + fn internal_error(_: *const libc::c_char, _: ...); + fn valid_array_reference(_: *const libc::c_char, _: libc::c_int) -> libc::c_int; + fn array_variable_name( + _: *const libc::c_char, + _: libc::c_int, + _: *mut *mut libc::c_char, + _: *mut libc::c_int, + ) -> *mut libc::c_char; + fn skipsubscript(_: *const libc::c_char, _: libc::c_int, _: libc::c_int) -> libc::c_int; + fn sh_eaccess(_: *const libc::c_char, _: libc::c_int) -> libc::c_int; + fn sh_makepath( + _: *const libc::c_char, + _: *const libc::c_char, + _: libc::c_int, + ) -> *mut libc::c_char; + fn throw_to_top_level(); + static mut interrupt_state: sig_atomic_t; + static mut terminating_signal: sig_atomic_t; + fn termsig_handler(_: libc::c_int); + fn get_string_value(_: *const libc::c_char) -> *mut libc::c_char; + fn sh_single_quote(_: *const libc::c_char) -> *mut libc::c_char; + fn sh_contains_shell_metas(_: *const libc::c_char) -> libc::c_int; + fn ansic_quote(_: *mut libc::c_char, _: libc::c_int, _: *mut libc::c_int) -> *mut libc::c_char; + fn ansic_shouldquote(_: *const libc::c_char) -> libc::c_int; + fn substring(_: *const libc::c_char, _: libc::c_int, _: libc::c_int) -> *mut libc::c_char; + fn strvec_create(_: libc::c_int) -> *mut *mut libc::c_char; + fn itos(_: intmax_t) -> *mut libc::c_char; + fn get_new_window_size(_: libc::c_int, _: *mut libc::c_int, _: *mut libc::c_int); + static mut check_window_size: libc::c_int; + fn getmaxgroups() -> libc::c_int; + static mut current_user: user_info; + static mut expand_aliases: libc::c_int; + static mut interactive_comments: libc::c_int; + fn get_dirstack_from_string(_: *mut libc::c_char) -> *mut libc::c_char; + static mut print_shift_error: libc::c_int; + static mut source_searches_cwd: libc::c_int; + static mut source_uses_path: libc::c_int; + static mut tilde_expansion_preexpansion_hook: Option; + static mut tilde_additional_prefixes: *mut *mut libc::c_char; + static mut tilde_additional_suffixes: *mut *mut libc::c_char; + fn tilde_expand(_: *const libc::c_char) -> *mut libc::c_char; +} -- Gitee