diff --git a/bash-5.1/builtins_rust/declare/src/lib.rs b/bash-5.1/builtins_rust/declare/src/lib.rs index 44b8c3eb6eb91a5f26283d8bee90d58b19772ac7..19548a7e29d0332ae28a9cb672ba262460dc7783 100644 --- a/bash-5.1/builtins_rust/declare/src/lib.rs +++ b/bash-5.1/builtins_rust/declare/src/lib.rs @@ -777,7 +777,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i /* There are arguments left, so we are making variables. */ - while list !=std::ptr::null_mut() { /* declare [-aAfFirx] name [name ...] */ + 'outter: while list !=std::ptr::null_mut() { /* declare [-aAfFirx] name [name ...] */ let mut value:* mut c_char; let mut name:* mut c_char; let mut oldname:* mut c_char; @@ -817,7 +817,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i VSETATTR (var, att_invisible!()); libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } if offset !=0 { /* declare [-aAfFirx] name=value */ @@ -839,14 +839,14 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i assign_error+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } else if check_selfref (name, value, 0) !=0 {/* disallow self references at global scope, warn at function scope */ if variable_context == 0 { builtin_error (CString::new("%s: nameref variable self references not allowed").unwrap().as_ptr(), name); assign_error+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } else { builtin_warning (CString::new("%s: circular name reference").unwrap().as_ptr(), name); } @@ -857,11 +857,11 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i assign_error+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } } //restart_new_var_name: - loop { + 'inner: loop { var_exists = 0; array_exists = 0; creating_array = 0; @@ -878,7 +878,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i assign_error+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } subscript_start = t; @@ -897,7 +897,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i assign_error+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } /* If VARIABLE_CONTEXT has a non-zero value, then we are executing inside of a function. This means we should make local variables, @@ -965,7 +965,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } if var != std::ptr::null_mut() && nameref_p (var) !=0 && readonly_p (var) != 0 && nameref_cell (var) != std::ptr::null_mut() && (flags_off & att_nameref!()) !=0 { @@ -973,7 +973,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } } else { var = std::ptr::null_mut(); @@ -997,7 +997,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } else if (flags_on & (att_array!()|att_assoc!())) !=0 { if (flags_on & att_array!()) !=0 { sh_invalidopt (CString::new("-a").unwrap().as_ptr() as * mut c_char); @@ -1008,7 +1008,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } /* declare -[Ff] name [name...] */ if flags_on == att_function!() && flags_off == 0 { @@ -1038,7 +1038,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i } libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } } else { /* declare -[aAinrx] name [name...] */ /* Non-null if we just created or fetched a local variable. */ @@ -1086,7 +1086,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } /* If all we're doing is turning off the nameref attribute, don't bother with VAR at all, whether it exists or not. Just turn it @@ -1095,7 +1095,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i VUNSETATTR (refvar, att_nameref!()); libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } if refvar !=std::ptr::null_mut() { @@ -1193,7 +1193,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i assign_error+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } *((name as usize + offset as usize) as * mut c_char) = '\0' as c_char; value = (name as usize + namelen as usize) as * mut c_char; @@ -1207,7 +1207,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i } //goto restart_new_var_name; - continue; + continue 'inner; /* NOTREACHED */ } } @@ -1245,7 +1245,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i /* Has to appear in brackets */ libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } created_var = 1; } else if (array_p (var) !=0 || assoc_p (var) !=0 ) && (flags_on & att_nameref!()) !=0 { @@ -1254,13 +1254,13 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i assign_error+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } else if nameref_p (var) !=0 && (flags_on & att_nameref!()) == 0 && (flags_off & att_nameref!()) == 0 && offset !=0 && valid_nameref_value (value, 1) == 0 { builtin_error (CString::new("`%s': invalid variable name for name reference").unwrap().as_ptr(), value); any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } else if (flags_on & att_nameref!()) !=0 { /* Check of offset is to allow an assignment to a nameref var as part of the declare word to override existing value */ @@ -1269,7 +1269,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } if readonly_p (var) !=0 { @@ -1277,7 +1277,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } /* ksh93 compat: turning on nameref attribute turns off -ilu */ VUNSETATTR (var, att_integer!()|att_uppercase!()|att_lowercase!()|att_capcase!()); @@ -1289,7 +1289,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } /* Cannot use declare to assign value to readonly or noassign @@ -1301,7 +1301,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i assign_error+=1; libc::free (name as * mut c_void); list = (*list).next; - continue; + continue 'outter; } /* make declare a[2]=foo as similar to a[2]=foo as possible if @@ -1336,7 +1336,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - break; + continue 'outter; } if (flags_on & att_array!()) !=0 && assoc_p (var) !=0 { @@ -1344,7 +1344,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - break; + continue 'outter; } if (flags_on & att_assoc!()) !=0 && array_p (var) !=0 { @@ -1352,7 +1352,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i any_failed+=1; libc::free (name as * mut c_void); list = (*list).next; - break; + continue 'outter; } /* declare -A name[[n]] makes name an associative array variable. */ @@ -1407,7 +1407,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i flags_off |= offref; libc::free (name as * mut c_void); list = (*list).next; - break; + continue 'outter; } } else if simple_array_assign !=0 { /* let bind_{array,assoc}_variable take care of this. */ @@ -1443,7 +1443,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i flags_off |= offref; libc::free (name as * mut c_void); list = (*list).next; - break; + continue 'outter; } } @@ -1501,7 +1501,7 @@ pub extern "C" fn r_declare_internal (mut list:* mut WordList, local_var:i32)->i stupidly_hack_special_variables (name); libc::free (name as * mut c_void); list = (*list).next; - break; + continue 'outter; } } if assign_error !=0 { diff --git a/bash-5.1/builtins_rust/exec_cmd/src/lib.rs b/bash-5.1/builtins_rust/exec_cmd/src/lib.rs index 23bb0478f51e813e4c4fec98b417d6c088ddd2e0..3541d011fbf9549b0cd5acb6593ab7a853fc2faa 100644 --- a/bash-5.1/builtins_rust/exec_cmd/src/lib.rs +++ b/bash-5.1/builtins_rust/exec_cmd/src/lib.rs @@ -760,7 +760,7 @@ unsafe fn get_cmd_type (command : *mut libc::c_char) -> CMDType{ else if libc::strcmp(command, b"compgen\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0{ types = CMDType::CompgenCmd; } - else if libc::strcmp(command,b"declare\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0{ + else if libc::strcmp(command,b"declare\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 || libc::strcmp(command,b"typeset\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 { types = CMDType::DeclareCmd; } else if libc::strcmp(command,b"local\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0{ @@ -844,8 +844,7 @@ unsafe fn get_cmd_type (command : *mut libc::c_char) -> CMDType{ else if libc::strcmp(command,b"return\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 { types = CMDType::ReturnCmd; } - else if libc::strcmp(command,b"set\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 - || libc::strcmp(command,b"typeset\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 { + else if libc::strcmp(command,b"set\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 { types = CMDType::SetCmd; } else if libc::strcmp(command,b"unset\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 { diff --git a/record.txt b/record.txt index 6ba48791d2e3972b339c8278a4fbe6b1e0961d69..d72ae9ffa356f8fe40b6df07753b1639410c1ebd 100644 --- a/record.txt +++ b/record.txt @@ -91,3 +91,4 @@ 90 91 92 +93