diff --git a/bash-5.1/Cargo.toml b/bash-5.1/Cargo.toml index 3c97c62efc0b4de4ec23dcf1ecdead990980c148..48dca7e2264e2c3503fafd3f43eed8fe91c141a2 100644 --- a/bash-5.1/Cargo.toml +++ b/bash-5.1/Cargo.toml @@ -2,6 +2,9 @@ name = "rsbash" version = "0.1.0" edition = "2021" +[lib] +name = "rsbash" +crate-type = ["cdylib"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [workspace] diff --git a/bash-5.1/configure b/bash-5.1/configure index 0f1d3ed178f6339ad64abc93514065c467771d81..0d917697efd3adc03a884f7dcce0942c0899228d 100755 --- a/bash-5.1/configure +++ b/bash-5.1/configure @@ -4231,7 +4231,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$want_auto_cflags"; then AUTO_CFLAGS="-g ${GCC+-O2}" AUTO_LDFLAGS="-g ${GCC+-O2}" - STYLE_CFLAGS="${GCC+-Wno-parentheses} ${GCC+-Wno-format-security}" + STYLE_CFLAGS="${GCC+-Wno-parentheses} ${GCC+-Wno-format-security} ${GCC+-fPIC}" else AUTO_CFLAGS= AUTO_LDFLAGS= STYLE_CFLAGS= fi @@ -20255,6 +20255,7 @@ fi $as_echo "using $bash_cv_termcap_lib" >&6; } if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then LDFLAGS="$LDFLAGS -L./lib/termcap" + TERMCAP_LIB="./lib/termcap/libtermcap.a" TERMCAP_DEP="./lib/termcap/libtermcap.a" elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then diff --git a/bash-5.1/execute_cmd.c b/bash-5.1/execute_cmd.c index c86c1a079e4f8f588e2dee545c7bb90279466550..ecd509c32581a4e37a2b5e4ab5eb4bb138891e59 100644 --- a/bash-5.1/execute_cmd.c +++ b/bash-5.1/execute_cmd.c @@ -110,6 +110,8 @@ extern int errno; # include /* mbschr */ #endif +# include "./rsbuiltins.h" + extern int command_string_index; extern char *the_printed_command; extern time_t shell_start_time; @@ -4735,6 +4737,7 @@ execute_builtin (builtin, words, flags, subshell) error_trap = 0; should_keep = 0; + r_execute_cmd(); /* The eval builtin calls parse_and_execute, which does not know about the setting of flags, and always calls the execution functions with flags that will exit the shell on an error if -e is set. If the @@ -5308,7 +5311,6 @@ execute_builtin_or_function (words, builtin, var, redirects, int ofifo, nfifo, osize; void *ofifo_list; #endif - #if defined (PROCESS_SUBSTITUTION) begin_unwind_frame ("saved_fifos"); /* If we return, we longjmp and don't get a chance to restore the old diff --git a/bash-5.1/rsbuiltins.h b/bash-5.1/rsbuiltins.h new file mode 100644 index 0000000000000000000000000000000000000000..f3b7f9be9d9ad1014d1aab6e2550fd762765ebc1 --- /dev/null +++ b/bash-5.1/rsbuiltins.h @@ -0,0 +1,2 @@ +#include +int r_execute_cmd(); diff --git a/bash-5.1/src/lib.rs b/bash-5.1/src/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..874f7e601d0de1901eee964f3b7613a623bc330a --- /dev/null +++ b/bash-5.1/src/lib.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn r_execute_cmd() { + println!("hello"); +} + diff --git a/record.txt b/record.txt index 06e567b11dfdafeaf7d3edcc89864149383aeab6..535d2b01d3397c2228490875defc92370602ca46 100644 --- a/record.txt +++ b/record.txt @@ -5,3 +5,4 @@ 5 6 7 +8