From 81b83a769a0fa06be435b69f52e98c7399da14b5 Mon Sep 17 00:00:00 2001 From: wangmengc Date: Wed, 15 May 2024 09:53:27 +0800 Subject: [PATCH] add internal error internal warning function --- utshell-0.5/r_error/src/lib.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/utshell-0.5/r_error/src/lib.rs b/utshell-0.5/r_error/src/lib.rs index 532c3777..4bc13c12 100644 --- a/utshell-0.5/r_error/src/lib.rs +++ b/utshell-0.5/r_error/src/lib.rs @@ -153,4 +153,32 @@ pub unsafe extern "C" fn fatal_error(mut format: *const libc::c_char, mut args: vfprintf(stderr, format, args_0.as_va_list()); fprintf(stderr, b"\n\0" as *const u8 as *const libc::c_char); sh_exit(2 as libc::c_int); +} + +#[no_mangle] +pub unsafe extern "C" fn internal_error(mut format: *const libc::c_char, mut args: ...) { + let mut args_0: ::std::ffi::VaListImpl; + error_prolog(1 as libc::c_int); + args_0 = args.clone(); + vfprintf(stderr, format, args_0.as_va_list()); + fprintf(stderr, b"\n\0" as *const u8 as *const libc::c_char); +} +#[no_mangle] +pub unsafe extern "C" fn internal_warning( + mut format: *const libc::c_char, + mut args: ... +) { + let mut args_0: ::std::ffi::VaListImpl; + error_prolog(1 as libc::c_int); + fprintf( + stderr, + dcgettext( + 0 as *const libc::c_char, + b"warning: \0" as *const u8 as *const libc::c_char, + 5 as libc::c_int, + ), + ); + args_0 = args.clone(); + vfprintf(stderr, format, args_0.as_va_list()); + fprintf(stderr, b"\n\0" as *const u8 as *const libc::c_char); } \ No newline at end of file -- Gitee