| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/arrayfunc.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | int assoc_expand_once = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | int array_expand_once = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | static SHELL_VAR *bind_array_var_internal (SHELL_VAR *, arrayind_t, char *, char *, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | static SHELL_VAR *assign_array_element_internal (SHELL_VAR *, char *, char *, char *, int, char *, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | static char *quote_assign (const char *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | static void quote_array_assignment_chars (WORD_LIST *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | static char *array_value_internal (const char *, int, int, int *, arrayind_t *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | const char * const bash_badsub_errmsg = "bad array subscript"; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | convert_var_to_array (var) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | char *oldval; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ARRAY *array; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | oldval = ((var)->value); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | array = array_create (); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | if (oldval
| 18-65 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | array_insert (array, 0, oldval); executed 65 times by 1 test: array_insert (array, 0, oldval);Executed by:
| 65 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | do { if (((
executed 65 times by 1 test: } while (0);sh_xfree((((var)->value)), "arrayfunc.c", 80);Executed by:
| 18-65 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ((var)->value = (char *)(array)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | var->dynamic_value = (sh_var_value_func_t *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | var->assign_func = (sh_var_assign_func_t *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | do { if ((
| 0-83 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ; } never executed: } while (0);end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | if (((((
| 0-83 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | array_needs_making++; never executed: array_needs_making++; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | ((var)->attributes |= (0x0000004)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ((var)->attributes &= ~(0x0001000)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ((var)->attributes &= ~(0x0000040)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | ((var)->attributes &= ~(0x0000800)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | return executed 83 times by 1 test: var;return var;Executed by:
executed 83 times by 1 test: return var;Executed by:
| 83 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | convert_var_to_assoc (var) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | char *oldval; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | HASH_TABLE *hash; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | oldval = ((var)->value); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | hash = (hash_create((0))); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | if (oldval
| 0-2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | assoc_insert (hash, (char *)strcpy (sh_xmalloc((1 + strlen ("0")), "arrayfunc.c", 115), ("0")), oldval); executed 2 times by 1 test: assoc_insert (hash, (char *)strcpy (sh_xmalloc((1 + strlen ("0")), "arrayfunc.c", 115), ("0")), oldval);Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | do { if (((
executed 2 times by 1 test: } while (0);sh_xfree((((var)->value)), "arrayfunc.c", 117);Executed by:
| 0-2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ((var)->value = (char *)(hash)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | var->dynamic_value = (sh_var_value_func_t *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | var->assign_func = (sh_var_assign_func_t *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | do { if ((
| 0-2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | ; } never executed: } while (0);end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | if (((((
| 0-2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | array_needs_making++; never executed: array_needs_making++; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | ((var)->attributes |= (0x0000040)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ((var)->attributes &= ~(0x0001000)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | ((var)->attributes &= ~(0x0000004)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | ((var)->attributes &= ~(0x0000800)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | return executed 2 times by 1 test: var;return var;Executed by:
executed 2 times by 1 test: return var;Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | make_array_variable_value (entry, ind, key, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | SHELL_VAR *entry; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | arrayind_t ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | char *key; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | char *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | SHELL_VAR *dentry; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | char *newval; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | if (flags & 0x0001
| 14-14214 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | dentry = (SHELL_VAR *)sh_xmalloc((sizeof (SHELL_VAR)), "arrayfunc.c", 155); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | dentry->name = (char *)strcpy (sh_xmalloc((1 + strlen (entry->name)), "arrayfunc.c", 156), (entry->name)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | if (((((
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | newval = assoc_reference ((HASH_TABLE *)((entry)->value), key); executed 7 times by 1 test: newval = assoc_reference ((HASH_TABLE *)((entry)->value), key);Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | newval = array_reference ((ARRAY *)((entry)->value), ind); executed 7 times by 1 test: newval = array_reference ((ARRAY *)((entry)->value), ind);Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | if (newval
| 3-11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | dentry->value = (char *)strcpy (sh_xmalloc((1 + strlen (newval)), "arrayfunc.c", 162), (newval)); executed 11 times by 1 test: dentry->value = (char *)strcpy (sh_xmalloc((1 + strlen (newval)), "arrayfunc.c", 162), (newval));Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | dentry->value = (char *)sh_xmalloc((1), "arrayfunc.c", 165); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | dentry->value[0] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | dentry->exportstr = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | dentry->attributes = entry->attributes & ~(0x0000004|0x0000040|0x0000001); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | newval = make_variable_value (dentry, value, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | dispose_variable (dentry); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | newval = make_variable_value (entry, value, flags); executed 14214 times by 1 test: newval = make_variable_value (entry, value, flags);Executed by:
| 14214 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | return executed 14228 times by 1 test: newval;return newval;Executed by:
executed 14228 times by 1 test: return newval;Executed by:
| 14228 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | static SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | bind_array_var_internal (entry, ind, key, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | SHELL_VAR *entry; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | arrayind_t ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | char *key; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | char *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | char *newval; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | newval = make_array_variable_value (entry, ind, key, value, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | if (entry->assign_func
| 5-14193 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | (* executed 5 times by 1 test: entry->assign_func) (entry, newval, ind, key);(*entry->assign_func) (entry, newval, ind, key);Executed by:
executed 5 times by 1 test: (*entry->assign_func) (entry, newval, ind, key);Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | else if (((((
| 523-13670 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | assoc_insert ((HASH_TABLE *)((entry)->value), key, newval); executed 523 times by 1 test: assoc_insert ((HASH_TABLE *)((entry)->value), key, newval);Executed by:
| 523 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | array_insert ((ARRAY *)((entry)->value), ind, newval); executed 13670 times by 1 test: array_insert ((ARRAY *)((entry)->value), ind, newval);Executed by:
| 13670 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | do { if (newval
executed 14198 times by 1 test: } while (0);sh_xfree((newval), "arrayfunc.c", 199);Executed by:
| 0-14198 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | ((entry)->attributes &= ~(0x0001000)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | return executed 14198 times by 1 test: (entry);return (entry);Executed by:
executed 14198 times by 1 test: return (entry);Executed by:
| 14198 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | bind_array_variable (name, ind, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | char *name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | arrayind_t ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | char *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | SHELL_VAR *entry; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | entry = find_shell_variable (name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | if (entry == (SHELL_VAR *) 0
| 48-10384 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | entry = find_variable_nameref_for_create (name, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | if (entry == (void *)&nameref_invalid_value
| 5-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | return executed 5 times by 1 test: ((SHELL_VAR *)0);return ((SHELL_VAR *)0);Executed by:
executed 5 times by 1 test: return ((SHELL_VAR *)0);Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | if (entry
| 0-41 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | entry = make_new_array_variable (((entry)->value)); executed 2 times by 1 test: entry = make_new_array_variable (((entry)->value));Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } executed 43 times by 1 test: end of blockExecuted by:
| 43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | if (entry == (SHELL_VAR *) 0
| 41-10386 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | entry = make_new_array_variable (name); executed 41 times by 1 test: entry = make_new_array_variable (name);Executed by:
| 41 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | else if ((((((
| 0-10376 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | if (((((
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | err_readonly (name); executed 10 times by 1 test: err_readonly (name);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | return executed 10 times by 1 test: (entry);return (entry);Executed by:
executed 10 times by 1 test: return (entry);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | else if (((((
| 24-10352 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | entry = convert_var_to_array (entry); executed 24 times by 1 test: entry = convert_var_to_array (entry);Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | return executed 10417 times by 1 test: (bind_array_var_internal (entry, ind, 0, value, flags));return (bind_array_var_internal (entry, ind, 0, value, flags));Executed by:
executed 10417 times by 1 test: return (bind_array_var_internal (entry, ind, 0, value, flags));Executed by:
| 10417 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | bind_array_element (entry, ind, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | SHELL_VAR *entry; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | arrayind_t ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | char *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | return executed 141 times by 1 test: (bind_array_var_internal (entry, ind, 0, value, flags));return (bind_array_var_internal (entry, ind, 0, value, flags));Executed by:
executed 141 times by 1 test: return (bind_array_var_internal (entry, ind, 0, value, flags));Executed by:
| 141 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | bind_assoc_variable (entry, name, key, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | SHELL_VAR *entry; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | char *name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | char *key; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | char *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | if ((((((
| 0-371 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | if (((((
| 0-2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | err_readonly (name); executed 2 times by 1 test: err_readonly (name);Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | return executed 2 times by 1 test: (entry);return (entry);Executed by:
executed 2 times by 1 test: return (entry);Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | return executed 371 times by 1 test: (bind_array_var_internal (entry, 0, key, value, flags));return (bind_array_var_internal (entry, 0, key, value, flags));Executed by:
executed 371 times by 1 test: return (bind_array_var_internal (entry, 0, key, value, flags));Executed by:
| 371 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | assign_array_element (name, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | char *name, *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | char *sub, *vname; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | int sublen; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | SHELL_VAR *entry; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | vname = array_variable_name (name, (flags & 0x0080) != 0, &sub, &sublen); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | if (vname == 0
| 11-10787 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | return executed 11 times by 1 test: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );Executed by:
executed 11 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | ((void *)0) executed 11 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ); executed 11 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | if ((((
| 0-10785 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | sh_xfree((vname), "arrayfunc.c", 294); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | err_badarraysub (name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | return executed 16 times by 1 test: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );Executed by:
executed 16 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | ((void *)0) executed 16 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | ); executed 16 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | entry = find_variable (vname); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | entry = assign_array_element_internal (entry, name, vname, sub, sublen, value, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | sh_xfree((vname), "arrayfunc.c", 302); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | return executed 10762 times by 1 test: entry;return entry;Executed by:
executed 10762 times by 1 test: return entry;Executed by:
| 10762 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | static SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | assign_array_element_internal (entry, name, vname, sub, sublen, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | SHELL_VAR *entry; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | char *name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | char *vname; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | char *sub; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | int sublen; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | char *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | char *akey; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | arrayind_t ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | if (entry
| 48-10723 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | sub[sublen-1] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | if ((
| 10-362 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | akey = expand_assignment_string_to_string (sub, 0); executed 362 times by 1 test: akey = expand_assignment_string_to_string (sub, 0);Executed by:
| 362 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | akey = (char *)strcpy (sh_xmalloc((1 + strlen (sub)), "arrayfunc.c", 325), (sub)); executed 10 times by 1 test: akey = (char *)strcpy (sh_xmalloc((1 + strlen (sub)), "arrayfunc.c", 325), (sub));Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | sub[sublen-1] = ']'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | if (akey == 0
| 0-371 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | err_badarraysub (name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | do { if (akey
never executed: } while (0);sh_xfree((akey), "arrayfunc.c", 330); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | return never executed: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ((void *)0) never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | ); never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | entry = bind_assoc_variable (entry, vname, akey, value, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } executed 371 times by 1 test: end of blockExecuted by:
| 371 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | ind = array_expand_index (entry, sub, sublen, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | if (entry
| 14-10343 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | ind = (((((
executed 14 times by 1 test: ind = (((((entry)->attributes) & (0x0000004))) ? (((ARRAY *)((entry)->value))->max_index) : 0) + 1 + ind;Executed by:
| 0-14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | if (ind < 0
| 10-10381 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | err_badarraysub (name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | return executed 10 times by 1 test: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );Executed by:
executed 10 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | ((void *)0) executed 10 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | ); executed 10 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | entry = bind_array_variable (vname, ind, value, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } executed 10381 times by 1 test: end of blockExecuted by:
| 10381 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | return executed 10752 times by 1 test: (entry);return (entry);Executed by:
executed 10752 times by 1 test: return (entry);Executed by:
| 10752 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | find_or_make_array_variable (name, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | char *name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | var = find_variable (name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | if (var == 0
| 202-269 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | var = find_variable_last_nameref (name, 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | if (var
| 0-188 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | internal_warning ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | "%s: removing nameref attribute" | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | , name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | ((var)->attributes &= ~(0x0000800)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | if (var
| 5-188 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | if (valid_nameref_value (((var)->value), 2) == 0
| 1-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | sh_invalidid (((var)->value)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | return executed 8 times by 1 test: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );Executed by:
executed 8 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | ((void *)0) executed 8 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | ); executed 8 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | var = (
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } executed 194 times by 1 test: end of blockExecuted by:
| 194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | if (var == 0
| 188-275 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | var = (
executed 188 times by 1 test: var = (flags & 2) ? make_new_assoc_variable (name) : make_new_array_variable (name);Executed by:
| 0-188 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | else if ((
| 0-275 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | if (((((
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | err_readonly (name); executed 11 times by 1 test: err_readonly (name);Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | return executed 11 times by 1 test: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );Executed by:
executed 11 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | ((void *)0) executed 11 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | ); executed 11 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | else if ((
| 0-252 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | last_command_exit_value = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | report_error ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | "%s: cannot convert indexed to associative array" | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | , name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | return never executed: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | ((void *)0) never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | ); never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | else if (((((
| 29-174 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | var = convert_var_to_array (var); executed 29 times by 1 test: var = convert_var_to_array (var);Executed by:
| 29 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | return executed 452 times by 1 test: (var);return (var);Executed by:
executed 452 times by 1 test: return (var);Executed by:
| 452 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | assign_array_from_string (name, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | char *name, *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | int vflags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | vflags = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | if (flags & 0x0004
| 12-407 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | vflags |= 2; executed 12 times by 1 test: vflags |= 2;Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | var = find_or_make_array_variable (name, vflags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | if (var == 0
| 15-404 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | return executed 15 times by 1 test: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );Executed by:
executed 15 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | ((void *)0) executed 15 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | ); executed 15 times by 1 test: return ((SHELL_VAR *) ((void *)0) );Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | return executed 404 times by 1 test: (assign_array_var_from_string (var, value, flags));return (assign_array_var_from_string (var, value, flags));Executed by:
executed 404 times by 1 test: return (assign_array_var_from_string (var, value, flags));Executed by:
| 404 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | assign_array_var_from_word_list (var, list, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | WORD_LIST *list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | register arrayind_t i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | register WORD_LIST *l; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | ARRAY *a; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | a = (ARRAY *)((var)->value); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | i = (
| 0-25 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | for (l = list; l
| 25-148 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | bind_array_var_internal (var, i, 0, l->word->word, flags & ~0x0001); executed 148 times by 1 test: bind_array_var_internal (var, i, 0, l->word->word, flags & ~0x0001);Executed by:
| 148 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | ((var)->attributes &= ~(0x0001000)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | return executed 25 times by 1 test: var;return var;Executed by:
executed 25 times by 1 test: return var;Executed by:
| 25 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | WORD_LIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | expand_compound_array_assignment (var, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | char *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | WORD_LIST *list, *nlist; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | char *val; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | int ni; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | if (*
| 80-435 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | ni = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | val = extract_array_assignment_list (value, &ni); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | if (val == 0
| 0-80 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | return never executed: (WORD_LIST *)return (WORD_LIST *) ((void *)0) ;never executed: return (WORD_LIST *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | ((void *)0) never executed: return (WORD_LIST *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | ; never executed: return (WORD_LIST *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } executed 80 times by 1 test: end of blockExecuted by:
| 80 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | val = value; executed 435 times by 1 test: val = value;Executed by:
| 435 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | list = parse_string_to_word_list (val, 1, "array assign"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | if (var
| 0-515 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | if (val != value
| 12-65 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | sh_xfree((val), "arrayfunc.c", 483); executed 12 times by 1 test: sh_xfree((val), "arrayfunc.c", 483);Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | return executed 77 times by 1 test: list;return list;Executed by:
executed 77 times by 1 test: return list;Executed by:
| 77 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | if (list
| 27-411 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | quote_array_assignment_chars (list); executed 411 times by 1 test: quote_array_assignment_chars (list);Executed by:
| 411 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | nlist = list
| 27-411 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | dispose_words (list); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | if (val != value
| 66-369 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | sh_xfree((val), "arrayfunc.c", 501); executed 66 times by 1 test: sh_xfree((val), "arrayfunc.c", 501);Executed by:
| 66 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | return executed 435 times by 1 test: nlist;return nlist;Executed by:
executed 435 times by 1 test: return nlist;Executed by:
| 435 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | assign_compound_array_list (var, nlist, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | WORD_LIST *nlist; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | ARRAY *a; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | HASH_TABLE *h; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | WORD_LIST *list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | char *w, *val, *nval, *savecmd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | int len, iflags, free_val; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | arrayind_t ind, last_ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | char *akey; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | a = (var
| 0-512 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | h = (var
| 0-512 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | akey = (char *)0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | ind = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | if ((
| 14-498 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | if (a
| 0-428 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | array_flush (a); executed 428 times by 1 test: array_flush (a);Executed by:
| 428 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | else if (h
| 0-70 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | assoc_flush (h); executed 70 times by 1 test: assoc_flush (h);Executed by:
| 70 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } executed 498 times by 1 test: end of blockExecuted by:
| 498 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | last_ind = (a
| 7-435 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | for (list = nlist; list
| 509-3173 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | iflags = flags & ~0x0001; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | w = list->word->word; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | if ((
| 0-2108 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | len = skipsubscript (w, 0, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | if (w[len] != ']'
| 0-2108 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | if (((((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | err_badarraysub (w); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | nval = make_variable_value (var, w, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | if (var->assign_func
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | (* never executed: var->assign_func) (var, nval, last_ind, 0);(*var->assign_func) (var, nval, last_ind, 0);never executed: (*var->assign_func) (var, nval, last_ind, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | array_insert (a, last_ind, nval); never executed: array_insert (a, last_ind, nval); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | do { if (nval
never executed: } while (0);sh_xfree((nval), "arrayfunc.c", 567); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | last_ind++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | if (len == 1
| 10-2098 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | err_badarraysub (w); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | continue; executed 10 times by 1 test: continue;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | if (((
| 0-2098 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | last_command_exit_value = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | if (((((
| 4-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | report_error ( executed 4 times by 1 test: report_error ( dcgettext (((void *)0), "%s: invalid associative array key" , 5) , w);Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | dcgettext (((void *)0), executed 4 times by 1 test: report_error ( dcgettext (((void *)0), "%s: invalid associative array key" , 5) , w);Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | "%s: invalid associative array key" executed 4 times by 1 test: report_error ( dcgettext (((void *)0), "%s: invalid associative array key" , 5) , w);Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | , 5) executed 4 times by 1 test: report_error ( dcgettext (((void *)0), "%s: invalid associative array key" , 5) , w);Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | , w); executed 4 times by 1 test: report_error ( dcgettext (((void *)0), "%s: invalid associative array key" , 5) , w);Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | report_error ( executed 10 times by 1 test: report_error ( dcgettext (((void *)0), "%s: cannot assign to non-numeric index" , 5) , w);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | dcgettext (((void *)0), executed 10 times by 1 test: report_error ( dcgettext (((void *)0), "%s: cannot assign to non-numeric index" , 5) , w);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | "%s: cannot assign to non-numeric index" executed 10 times by 1 test: report_error ( dcgettext (((void *)0), "%s: cannot assign to non-numeric index" , 5) , w);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | , 5) executed 10 times by 1 test: report_error ( dcgettext (((void *)0), "%s: cannot assign to non-numeric index" , 5) , w);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | , w); executed 10 times by 1 test: report_error ( dcgettext (((void *)0), "%s: cannot assign to non-numeric index" , 5) , w);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | continue; executed 14 times by 1 test: continue;Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | if (((((
| 156-1928 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | ind = array_expand_index (var, w + 1, len, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | if (ind < 0
| 11-1914 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | ind = (((ARRAY *)((var)->value))->max_index) + 1 + ind; executed 11 times by 1 test: ind = (((ARRAY *)((var)->value))->max_index) + 1 + ind;Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | if (ind < 0
| 10-1915 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | err_badarraysub (w); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | continue; executed 10 times by 1 test: continue;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | last_ind = ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } executed 1915 times by 1 test: end of blockExecuted by:
| 1915 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | else if (((((
| 0-156 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | w[len] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | akey = expand_assignment_string_to_string (w+1, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | w[len] = ']'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | if (akey == 0
| 0-156 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | err_badarraysub (w); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | do { if (akey
never executed: } while (0);sh_xfree((akey), "arrayfunc.c", 612); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } executed 156 times by 1 test: end of blockExecuted by:
| 156 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | if (w[len + 1] == '+'
| 0-2067 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | iflags |= 0x0001; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | val = w + len + 3; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | val = w + len + 2; executed 2067 times by 1 test: val = w + len + 2;Executed by:
| 2067 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | else if (((((
| 15-1050 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | last_command_exit_value = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | report_error ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | "%s: %s: must use subscript when assigning associative array" | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | , var->name, w); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | continue; executed 15 times by 1 test: continue;Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | ind = last_ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | val = w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } executed 1050 times by 1 test: end of blockExecuted by:
| 1050 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | free_val = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | if (((((
| 156-2965 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | val = expand_assignment_string_to_string (val, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | if (val == 0
| 5-151 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | val = (char *)sh_xmalloc((1), "arrayfunc.c", 645); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | val[0] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | free_val = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | } executed 156 times by 1 test: end of blockExecuted by:
| 156 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | savecmd = this_command_name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | if (((((
| 55-3066 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | this_command_name = (char *) executed 55 times by 1 test: this_command_name = (char *) ((void *)0) ;Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | ((void *)0) executed 55 times by 1 test: this_command_name = (char *) ((void *)0) ;Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | ; executed 55 times by 1 test: this_command_name = (char *) ((void *)0) ;Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | bind_array_var_internal (var, ind, akey, val, iflags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | last_ind++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | this_command_name = savecmd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | if (free_val
| 156-2965 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | sh_xfree((val), "arrayfunc.c", 659); executed 156 times by 1 test: sh_xfree((val), "arrayfunc.c", 659);Executed by:
| 156 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | } executed 3121 times by 1 test: end of blockExecuted by:
| 3121 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } executed 509 times by 1 test: end of blockExecuted by:
| 509 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | assign_array_var_from_string (var, value, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | char *value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | WORD_LIST *nlist; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | if (value == 0
| 0-484 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | return never executed: var;return var;never executed: return var; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | nlist = expand_compound_array_assignment (var, value, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | assign_compound_array_list (var, nlist, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | if (nlist
| 30-448 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | dispose_words (nlist); executed 448 times by 1 test: dispose_words (nlist);Executed by:
| 448 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | if (var
| 0-478 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | (( executed 478 times by 1 test: var)->attributes &= ~(0x0001000));((var)->attributes &= ~(0x0001000));Executed by:
executed 478 times by 1 test: ((var)->attributes &= ~(0x0001000));Executed by:
| 478 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | return executed 478 times by 1 test: (var);return (var);Executed by:
executed 478 times by 1 test: return (var);Executed by:
| 478 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | static char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | quote_assign (string) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | const char *string; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | size_t slen; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | int saw_eq; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | char *temp, *t, *subs; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | const char *s, *send; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | int ss, se; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | slen = strlen (string); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | send = string + slen; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | t = temp = (char *)sh_xmalloc((slen * 2 + 1), "arrayfunc.c", 705); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | saw_eq = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | for (s = string; *
| 1952-9911 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | if (*
| 1955-7956 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | saw_eq = 1; executed 1955 times by 1 test: saw_eq = 1;Executed by:
| 1955 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | if (saw_eq == 0
| 2-7957 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | ss = s - string; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | se = skipsubscript (string, ss, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | subs = substring (s, ss, se); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | *t++ = '\\'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | strcpy (t, subs); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | t += se - ss; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | *t++ = '\\'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | *t++ = ']'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | s += se + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | sh_xfree((subs), "arrayfunc.c", 722); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | continue; executed 1952 times by 1 test: continue;Executed by:
| 1952 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | if (saw_eq == 0
| 0-7957 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | * never executed: t++ = '\\';*t++ = '\\';never executed: *t++ = '\\'; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | do { if (locale_mb_cur_max > 1
executed 6438 times by 1 test: else if (locale_utf8localemblength = 1;Executed by:
executed 131 times by 1 test: else { state_bak = state; mblength = mbrlen ((s), (send) - (s), &state); }mblength = 1;Executed by:
executed 1390 times by 1 test: if (mblength == (size_t)-2end of blockExecuted by:
executed 199 times by 1 test: else mblength = (end of blockExecuted by:
executed 7760 times by 1 test: for (_k = 0; _k < mblengthmblength = (mblength < 1) ? 1 : mblength;Executed by:
executed 9946 times by 1 test: t)++ = *(s)++;*(t)++ = *(s)++;Executed by:
executed 9946 times by 1 test: }*(t)++ = *(s)++;Executed by:
executed 7959 times by 1 test: else *(end of blockExecuted by:
never executed: t)++ = *(s)++;*(t)++ = *(s)++;never executed: } while (0);*(t)++ = *(s)++; | 0-9946 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } executed 7959 times by 1 test: end of blockExecuted by:
| 7959 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | *t = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | return executed 1952 times by 1 test: temp;return temp;Executed by:
executed 1952 times by 1 test: return temp;Executed by:
| 1952 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | quote_array_assignment_chars (list) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | WORD_LIST *list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | char *nword; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | WORD_LIST *l; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | for (l = list; l
| 411-2815 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | if (l->word == 0
| 0-2815 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | if ((
| 863-1952 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | continue; executed 863 times by 1 test: continue;Executed by:
| 863 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | if (l->word->word[0] != '['
| 0-1952 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | nword = quote_assign (l->word->word); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | sh_xfree((l->word->word), "arrayfunc.c", 755); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | l->word->word = nword; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | l->word->flags |= 0x000020; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } executed 1952 times by 1 test: end of blockExecuted by:
| 1952 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } executed 411 times by 1 test: end of blockExecuted by:
| 411 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | unbind_array_element (var, sub, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | char *sub; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | int len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | arrayind_t ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | char *akey; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | ARRAY_ELEMENT *ae; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | len = skipsubscript (sub, 0, (flags&1) || (var && ((((var)->attributes) & (0x0000040))))); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | if (sub[len] != ']'
| 0-112 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | builtin_error ("%s[%s: %s", var->name, sub, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | bash_badsub_errmsg | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | sub[len] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | if (((
| 0-109 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | if (((((
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | unbind_variable (var->name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | return executed 13 times by 1 test: (0);return (0);Executed by:
executed 13 times by 1 test: return (0);Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | if (((((
| 9-90 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | akey = (
| 4-5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | if (akey == 0
| 0-9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | builtin_error ("[%s]: %s", sub, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | bash_badsub_errmsg | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | do { if (akey
never executed: } while (0);sh_xfree((akey), "arrayfunc.c", 803); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | assoc_remove ((HASH_TABLE *)((var)->value), akey); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | if (akey != sub
| 4-5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | sh_xfree((akey), "arrayfunc.c", 808); executed 5 times by 1 test: sh_xfree((akey), "arrayfunc.c", 808);Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | } executed 9 times by 1 test: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | else if (((((
| 11-79 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | ind = array_expand_index (var, sub, len+1, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | if (ind < 0
| 8-71 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | ind = (((ARRAY *)((var)->value))->max_index) + 1 + ind; executed 8 times by 1 test: ind = (((ARRAY *)((var)->value))->max_index) + 1 + ind;Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | if (ind < 0
| 6-73 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | builtin_error ("[%s]: %s", sub, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | bash_badsub_errmsg | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | return executed 6 times by 1 test: -1;return -1;Executed by:
executed 6 times by 1 test: return -1;Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | ae = array_remove ((ARRAY *)((var)->value), ind); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | if (ae
| 35-38 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | array_dispose_element (ae); executed 35 times by 1 test: array_dispose_element (ae);Executed by:
| 35 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | } executed 73 times by 1 test: end of blockExecuted by:
| 73 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | akey = this_command_name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | ind = array_expand_index (var, sub, len+1, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | this_command_name = akey; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | if (ind == 0
| 1-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | unbind_variable (var->name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | return executed 1 time by 1 test: (0);return (0);Executed by:
executed 1 time by 1 test: return (0);Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | return executed 10 times by 1 test: -2;return -2;Executed by:
executed 10 times by 1 test: return -2;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | return executed 82 times by 1 test: 0;return 0;Executed by:
executed 82 times by 1 test: return 0;Executed by:
| 82 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | print_array_assignment (var, quoted) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | int quoted; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | char *vstr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | vstr = array_to_assign ((ARRAY *)((var)->value), quoted); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | if (vstr == 0
| 49-224 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | printf ("%s=%s\n", var->name, quoted ? "'()'" : "()"); executed 49 times by 1 test: printf ("%s=%s\n", var->name, quoted ? "'()'" : "()");Executed by:
| 49 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | printf ("%s=%s\n", var->name, vstr); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | sh_xfree((vstr), "arrayfunc.c", 858); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | } executed 224 times by 1 test: end of blockExecuted by:
| 224 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | print_assoc_assignment (var, quoted) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | int quoted; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | char *vstr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | vstr = assoc_to_assign ((HASH_TABLE *)((var)->value), quoted); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | if (vstr == 0
| 34-85 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | printf ("%s=%s\n", var->name, quoted ? "'()'" : "()"); executed 34 times by 1 test: printf ("%s=%s\n", var->name, quoted ? "'()'" : "()");Executed by:
| 34 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | printf ("%s=%s\n", var->name, vstr); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | sh_xfree((vstr), "arrayfunc.c", 878); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | } executed 85 times by 1 test: end of blockExecuted by:
| 85 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | valid_array_reference (name, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | const char *name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | char *t; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | int r, len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | t = mbschr (name, '['); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | if (t
| 35206-17891781 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | *t = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | r = legal_identifier (name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | *t = '['; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | if (r == 0
| 3-35203 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | return executed 3 times by 1 test: 0;return 0;Executed by:
executed 3 times by 1 test: return 0;Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | len = skipsubscript (t, 0, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | if (t[len] != ']'
| 0-35194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | return executed 9 times by 1 test: 0;return 0;Executed by:
executed 9 times by 1 test: return 0;Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | if (t[len+1] != '\0'
| 0-35194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | for (r = 1; r < len
| 30-35232 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | if ((((
| 0-35164 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | return executed 35164 times by 1 test: 1;return 1;Executed by:
executed 35164 times by 1 test: return 1;Executed by:
| 35164 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | return executed 30 times by 1 test: 0;return 0;Executed by:
executed 30 times by 1 test: return 0;Executed by:
| 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | return executed 17891781 times by 1 test: 0;return 0;Executed by:
executed 17891781 times by 1 test: return 0;Executed by:
| 17891781 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | arrayind_t | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | array_expand_index (var, s, len, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | int len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | char *exp, *t, *savecmd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | int expok; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | arrayind_t val; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | exp = (char *)sh_xmalloc((len), "arrayfunc.c", 938); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | __builtin_strncpy ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | exp | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | , | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | s | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | , | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | len - 1 | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | exp[len - 1] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | t = expand_arith_string (exp, 0x001|0x100|0x200); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | savecmd = this_command_name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | this_command_name = (char *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | val = evalexp (t, 0, &expok); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | this_command_name = savecmd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | if (t != exp
| 0-27600 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | sh_xfree((t), "arrayfunc.c", 953); executed 27600 times by 1 test: sh_xfree((t), "arrayfunc.c", 953);Executed by:
| 27600 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | sh_xfree((exp), "arrayfunc.c", 954); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | if (expok == 0
| 12-27588 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | last_command_exit_value = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | if (no_longjmp_on_fatal_error
| 0-12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | top_level_cleanup (); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | jump_to_top_level (2); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | return executed 27588 times by 1 test: val;return val;Executed by:
executed 27588 times by 1 test: return val;Executed by:
| 27588 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | array_variable_name (s, flags, subp, lenp) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | const char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | char **subp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | int *lenp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | char *t, *ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | int ind, ni; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | t = mbschr (s, '['); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | if (t == 0
| 0-64120 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | if (subp
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | * never executed: subp = t;*subp = t;never executed: *subp = t; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | if (lenp
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | * never executed: lenp = 0;*lenp = 0;never executed: *lenp = 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | return never executed: ((char *)return ((char *) ((void *)0) );never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | ); never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | ind = t - s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | ni = skipsubscript (s, ind, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | if (ni <= ind + 1
| 0-64109 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | err_badarraysub (s); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | if (subp
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | * executed 11 times by 1 test: subp = t;*subp = t;Executed by:
executed 11 times by 1 test: *subp = t;Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | if (lenp
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | * executed 11 times by 1 test: lenp = 0;*lenp = 0;Executed by:
executed 11 times by 1 test: *lenp = 0;Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | return executed 11 times by 1 test: ((char *)return ((char *) ((void *)0) );Executed by:
executed 11 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | ((void *)0) executed 11 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | ); executed 11 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | *t = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | ret = (char *)strcpy (sh_xmalloc((1 + strlen (s)), "arrayfunc.c", 1003), (s)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | *t++ = '['; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | if (subp
| 30251-33858 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | * executed 33858 times by 1 test: subp = t;*subp = t;Executed by:
executed 33858 times by 1 test: *subp = t;Executed by:
| 33858 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | if (lenp
| 27300-36809 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | * executed 27300 times by 1 test: lenp = ni - ind;*lenp = ni - ind;Executed by:
executed 27300 times by 1 test: *lenp = ni - ind;Executed by:
| 27300 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | return executed 64109 times by 1 test: ret;return ret;Executed by:
executed 64109 times by 1 test: return ret;Executed by:
| 64109 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | SHELL_VAR * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | array_variable_part (s, flags, subp, lenp) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | const char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | char **subp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | int *lenp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | char *t; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | t = array_variable_name (s, flags, subp, lenp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | if (t == 0
| 0-43180 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | return never executed: ((SHELL_VAR *)return ((SHELL_VAR *) ((void *)0) );never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | ((void *)0) never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | ); never executed: return ((SHELL_VAR *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | var = find_variable (t); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | sh_xfree((t), "arrayfunc.c", 1032); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | return executed 43180 times by 1 test: var;return var;Executed by:
executed 43180 times by 1 test: return var;Executed by:
| 43180 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | static char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | array_value_internal (s, quoted, flags, rtype, indp) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | const char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | int quoted, flags, *rtype; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | arrayind_t *indp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | int len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | arrayind_t ind; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | char *akey; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | char *retval, *t, *temp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | WORD_LIST *l; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | var = array_variable_part (s, (flags&0x020) ? 1 : 0, &t, &len); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | if (len == 0
| 0-16207 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | return never executed: ((char *)return ((char *) ((void *)0) );never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | ); never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | akey = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | if (((
| 0-15535 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | if (rtype
| 0-828 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | * executed 828 times by 1 test: rtype = (*rtype = (t[0] == '*') ? 1 : 2;Executed by:
executed 828 times by 1 test: *rtype = (t[0] == '*') ? 1 : 2;Executed by:
| 156-828 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | if ((
| 0-828 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | err_badarraysub (s); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | return never executed: ((char *)return ((char *) ((void *)0) );never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | ); never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | else if (var == 0
| 2-823 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | return executed 7 times by 1 test: ((char *)return ((char *) ((void *)0) );Executed by:
executed 7 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | ((void *)0) executed 7 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | ); executed 7 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | else if (((((
| 9-727 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | l = make_word_list (make_word(((var)->value)), ((WORD_LIST *) executed 9 times by 1 test: l = make_word_list (make_word(((var)->value)), ((WORD_LIST *) ((void *)0) ));Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | ((void *)0) executed 9 times by 1 test: l = make_word_list (make_word(((var)->value)), ((WORD_LIST *) ((void *)0) ));Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | )); executed 9 times by 1 test: l = make_word_list (make_word(((var)->value)), ((WORD_LIST *) ((void *)0) ));Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | else if (((((
| 85-727 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | l = assoc_to_word_list ((HASH_TABLE *)((var)->value)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | if (l == (WORD_LIST *)
| 1-84 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | ((void *)0)
| 1-84 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | return executed 1 time by 1 test: ((char *)return ((char *) ((void *)0) );Executed by:
executed 1 time by 1 test: return ((char *) ((void *)0) );Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | ((void *)0) executed 1 time by 1 test: return ((char *) ((void *)0) );Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | ); executed 1 time by 1 test: return ((char *) ((void *)0) );Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | } executed 84 times by 1 test: end of blockExecuted by:
| 84 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | l = array_to_word_list ((ARRAY *)((var)->value)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | if (l == (WORD_LIST *)
| 26-701 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | ((void *)0)
| 26-701 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | return executed 26 times by 1 test: ((char *) return ((char *) ((void *)0) );Executed by:
executed 26 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | ((void *)0) executed 26 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | ); executed 26 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | } executed 701 times by 1 test: end of blockExecuted by:
| 701 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | if (t[0] == '*'
| 50-638 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | temp = string_list_dollar_star (l, quoted, (flags & 0x010) ? 0x08 : 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | retval = quote_string (temp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | sh_xfree((temp), "arrayfunc.c", 1115); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | retval = string_list_dollar_at (l, quoted, (flags & 0x010) ? 0x08 : 0); executed 744 times by 1 test: retval = string_list_dollar_at (l, quoted, (flags & 0x010) ? 0x08 : 0);Executed by:
| 744 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | dispose_words (l); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | } executed 794 times by 1 test: end of blockExecuted by:
| 794 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | if (rtype
| 5124-10255 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | * executed 5124 times by 1 test: rtype = 0;*rtype = 0;Executed by:
executed 5124 times by 1 test: *rtype = 0;Executed by:
| 5124 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | if (var == 0
| 12-15367 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | if ((
| 0-15174 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | ind = array_expand_index (var, t, len, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | if (ind < 0
| 11-15147 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | if (var
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | ind = (((ARRAY *)((var)->value))->max_index) + 1 + ind; executed 11 times by 1 test: ind = (((ARRAY *)((var)->value))->max_index) + 1 + ind;Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | if (ind < 0
| 1-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | do { if (var
executed 10 times by 1 test: else { t[-1] = '\0'; err_badarraysub (s); t[-1] = '['; }err_badarraysub (var->name);Executed by:
never executed: returnend of blockexecuted 10 times by 1 test: ((char *)return ((char *) ((void *)0) );Executed by:
executed 10 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | ((void *)0) executed 10 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | ); executed 10 times by 1 test: }return ((char *) ((void *)0) );Executed by:
never executed: while (0);end of block | 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | if (indp
| 5-15143 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | * executed 15143 times by 1 test: indp = ind;*indp = ind;Executed by:
executed 15143 times by 1 test: *indp = ind;Executed by:
| 15143 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | } executed 15148 times by 1 test: end of blockExecuted by:
| 15148 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | else if (indp
| 0-141 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | ind = *indp; executed 141 times by 1 test: ind = *indp;Executed by:
| 141 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | } executed 15289 times by 1 test: end of blockExecuted by:
| 15289 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | else if (((((
| 0-64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | t[len - 1] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | if ((
| 7-57 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | akey = expand_assignment_string_to_string (t, 0); executed 57 times by 1 test: akey = expand_assignment_string_to_string (t, 0);Executed by:
| 57 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | akey = (char *)strcpy (sh_xmalloc((1 + strlen (t)), "arrayfunc.c", 1152), (t)); executed 7 times by 1 test: akey = (char *)strcpy (sh_xmalloc((1 + strlen (t)), "arrayfunc.c", 1152), (t));Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | t[len - 1] = ']'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | if (akey == 0
| 0-64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | do { if (akey
never executed: } while (0);sh_xfree((akey), "arrayfunc.c", 1156); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | do { if (var
never executed: else { t[-1] = '\0'; err_badarraysub (s); t[-1] = '['; }err_badarraysub (var->name);never executed: returnend of blocknever executed: ((char *)return ((char *) ((void *)0) );never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | ); never executed: } while (0);return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | } executed 64 times by 1 test: end of blockExecuted by:
| 64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | if (var == 0
| 0-15341 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | do { if (akey
never executed: } while (0);sh_xfree((akey), "arrayfunc.c", 1163); | 0-12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | return executed 12 times by 1 test: ((char *)return ((char *) ((void *)0) );Executed by:
executed 12 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | ((void *)0) executed 12 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | ); executed 12 times by 1 test: return ((char *) ((void *)0) );Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | if (((((
| 63-15214 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | return executed 63 times by 1 test: (ind == 0 ? ((var)->value) : (char *)return (ind == 0 ? ((var)->value) : (char *) ((void *)0) );Executed by:
executed 63 times by 1 test: return (ind == 0 ? ((var)->value) : (char *) ((void *)0) );Executed by:
| 63 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | ((void *)0) executed 63 times by 1 test: return (ind == 0 ? ((var)->value) : (char *) ((void *)0) );Executed by:
| 63 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | ); executed 63 times by 1 test: return (ind == 0 ? ((var)->value) : (char *) ((void *)0) );Executed by:
| 63 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | else if (((((
| 64-15214 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | retval = assoc_reference ((HASH_TABLE *)((var)->value), akey); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | sh_xfree((akey), "arrayfunc.c", 1171); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | } executed 64 times by 1 test: end of blockExecuted by:
| 64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | retval = array_reference ((ARRAY *)((var)->value), ind); executed 15214 times by 1 test: retval = array_reference ((ARRAY *)((var)->value), ind);Executed by:
| 15214 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | return executed 16072 times by 1 test: retval;return retval;Executed by:
executed 16072 times by 1 test: return retval;Executed by:
| 16072 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | array_value (s, quoted, flags, rtype, indp) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | const char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | int quoted, flags, *rtype; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | arrayind_t *indp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | return executed 6102 times by 1 test: (array_value_internal (s, quoted, flags|0x001, rtype, indp));return (array_value_internal (s, quoted, flags|0x001, rtype, indp));Executed by:
executed 6102 times by 1 test: return (array_value_internal (s, quoted, flags|0x001, rtype, indp));Executed by:
| 6102 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | get_array_value (s, flags, rtype, indp) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | const char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | int flags, *rtype; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | arrayind_t *indp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | return executed 10105 times by 1 test: (array_value_internal (s, 0, flags, rtype, indp));return (array_value_internal (s, 0, flags, rtype, indp));Executed by:
executed 10105 times by 1 test: return (array_value_internal (s, 0, flags, rtype, indp));Executed by:
| 10105 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | array_keys (s, quoted) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | int quoted; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | int len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | char *retval, *t, *temp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | WORD_LIST *l; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | SHELL_VAR *var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | var = array_variable_part (s, 0, &t, &len); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | if (var == 0
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | return never executed: (char *)return (char *) ((void *)0) ;never executed: return (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | ((void *)0) never executed: return (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | ; never executed: return (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | if (((
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | return never executed: (char *)return (char *) ((void *)0) ;never executed: return (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | ((void *)0) never executed: return (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | ; never executed: return (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | if (((((
| 0-32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | l = make_word_list (make_word("0"), ((WORD_LIST *) never executed: l = make_word_list (make_word("0"), ((WORD_LIST *) ((void *)0) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | ((void *)0) never executed: l = make_word_list (make_word("0"), ((WORD_LIST *) ((void *)0) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | )); never executed: l = make_word_list (make_word("0"), ((WORD_LIST *) ((void *)0) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | else if (((((
| 8-32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | l = assoc_keys_to_word_list ((HASH_TABLE *)((var)->value)); executed 32 times by 1 test: l = assoc_keys_to_word_list ((HASH_TABLE *)((var)->value));Executed by:
| 32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | l = array_keys_to_word_list ((ARRAY *)((var)->value)); executed 8 times by 1 test: l = array_keys_to_word_list ((ARRAY *)((var)->value));Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | if (l == (WORD_LIST *)
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | ((void *)0)
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | return never executed: ((char *) return ((char *) ((void *)0) );never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | ); never executed: return ((char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | if (t[0] == '*'
| 1-38 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | temp = string_list_dollar_star (l, quoted, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | retval = quote_string (temp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | sh_xfree((temp), "arrayfunc.c", 1236); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | retval = string_list_dollar_at (l, quoted, 0); executed 39 times by 1 test: retval = string_list_dollar_at (l, quoted, 0);Executed by:
| 39 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | dispose_words (l); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | return executed 40 times by 1 test: retval;return retval;Executed by:
executed 40 times by 1 test: return retval;Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |