| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | extern int rl_done, rl_dispatching; | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | static int histignore_item_func (struct ign *); | - |
| 29 | static int check_history_control (char *); | - |
| 30 | static void hc_erasedups (char *); | - |
| 31 | static void really_add_history (char *); | - |
| 32 | | - |
| 33 | static struct ignorevar histignore = | - |
| 34 | { | - |
| 35 | "HISTIGNORE", | - |
| 36 | (struct ign *)0, | - |
| 37 | 0, | - |
| 38 | (char *)0, | - |
| 39 | (sh_iv_item_func_t *)histignore_item_func, | - |
| 40 | }; | - |
| 41 | | - |
| 42 | | - |
| 43 | | - |
| 44 | | - |
| 45 | | - |
| 46 | | - |
| 47 | | - |
| 48 | int remember_on_history = 0; | - |
| 49 | int enable_history_list = 0; | - |
| 50 | | - |
| 51 | | - |
| 52 | | - |
| 53 | | - |
| 54 | | - |
| 55 | int history_lines_this_session; | - |
| 56 | | - |
| 57 | | - |
| 58 | int history_lines_in_file; | - |
| 59 | | - |
| 60 | | - |
| 61 | | - |
| 62 | | - |
| 63 | int history_expansion_inhibited; | - |
| 64 | | - |
| 65 | int double_quotes_inhibit_history_expansion = 0; | - |
| 66 | int command_oriented_history = 1; | - |
| 67 | | - |
| 68 | | - |
| 69 | | - |
| 70 | | - |
| 71 | int current_command_first_line_saved = 0; | - |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | int current_command_line_comment = 0; | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | int literal_history; | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | int force_append_history; | - |
| 85 | int history_control; | - |
| 86 | | - |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | int hist_last_line_added; | - |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | int hist_last_line_pushed; | - |
| 95 | | - |
| 96 | | - |
| 97 | | - |
| 98 | | - |
| 99 | int history_reediting; | - |
| 100 | | - |
| 101 | | - |
| 102 | | - |
| 103 | | - |
| 104 | int hist_verify; | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | int dont_save_function_defs; | - |
| 110 | | - |
| 111 | | - |
| 112 | static int bash_history_inhibit_expansion (char *, int); | - |
| 113 | | - |
| 114 | | - |
| 115 | static void re_edit (char *); | - |
| 116 | | - |
| 117 | static int history_expansion_p (char *); | - |
| 118 | static int shell_comment (char *); | - |
| 119 | static int should_expand (char *); | - |
| 120 | static HIST_ENTRY *last_history_entry (void); | - |
| 121 | static char *expand_histignore_pattern (char *); | - |
| 122 | static int history_should_ignore (char *); | - |
| 123 | | - |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | static int | - |
| 128 | bash_history_inhibit_expansion (string, i) | - |
| 129 | char *string; | - |
| 130 | int i; | - |
| 131 | { | - |
| 132 | int t; | - |
| 133 | char hx[2]; | - |
| 134 | | - |
| 135 | hx[0] = history_expansion_char; | - |
| 136 | hx[1] = '\0'; | - |
| 137 | | - |
| 138 | | - |
| 139 | | - |
| 140 | if (i > 0| TRUE | evaluated 218 times by 1 test | | FALSE | evaluated 47 times by 1 test |
&& (| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 217 times by 1 test |
string[i - 1] == '[')| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 217 times by 1 test |
&& ((| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
']') ? ((char *)mbschr ((string + i + 1), (']')) != (char *)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-218 |
| 141 | ((void *)0)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-1 |
| 142 | ) : 0)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
) | 0-1 |
| 143 | returnexecuted 1 time by 1 test: return (1); (1);executed 1 time by 1 test: return (1); | 1 |
| 144 | | - |
| 145 | | - |
| 146 | else if (i > 1| TRUE | evaluated 217 times by 1 test | | FALSE | evaluated 47 times by 1 test |
&& string[i - 1] == '{'| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 216 times by 1 test |
&& string[i - 2] == '$'| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
&& | 0-217 |
| 147 | ((| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
'}') ? ((char *)mbschr ((string + i + 1), ('}')) != (char *)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-1 |
| 148 | ((void *)0)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-1 |
| 149 | ) : 0)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
) | 0-1 |
| 150 | returnexecuted 1 time by 1 test: return (1); (1);executed 1 time by 1 test: return (1); | 1 |
| 151 | | - |
| 152 | else if (i > 1| TRUE | evaluated 216 times by 1 test | | FALSE | evaluated 47 times by 1 test |
&& string[i - 1] == '$'| TRUE | never evaluated | | FALSE | evaluated 216 times by 1 test |
&& string[i] == '!'| TRUE | never evaluated | | FALSE | never evaluated |
) | 0-216 |
| 153 | return never executed: return (1); (1);never executed: return (1); | 0 |
| 154 | | - |
| 155 | else if (extended_glob| TRUE | never evaluated | | FALSE | evaluated 263 times by 1 test |
&& i > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& string[i+1] == '('| TRUE | never evaluated | | FALSE | never evaluated |
&& ((| TRUE | never evaluated | | FALSE | never evaluated |
')') ? ((char *)mbschr ((string + i + 2), (')')) != (char *)| TRUE | never evaluated | | FALSE | never evaluated |
| 0-263 |
| 156 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 157 | ) : 0)| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 158 | return never executed: return (1); (1);never executed: return (1); | 0 |
| 159 | | - |
| 160 | | - |
| 161 | | - |
| 162 | | - |
| 163 | else if ((| TRUE | evaluated 215 times by 1 test | | FALSE | evaluated 48 times by 1 test |
t = skip_to_histexp (string, 0, hx, 0x001|0x200)) > 0| TRUE | evaluated 215 times by 1 test | | FALSE | evaluated 48 times by 1 test |
) | 48-215 |
| 164 | { | - |
| 165 | | - |
| 166 | | - |
| 167 | while (t < i| TRUE | evaluated 58 times by 1 test | | FALSE | evaluated 215 times by 1 test |
) | 58-215 |
| 168 | { | - |
| 169 | t = skip_to_histexp (string, t+1, hx, 0x001|0x200); | - |
| 170 | if (t <= 0| TRUE | never evaluated | | FALSE | evaluated 58 times by 1 test |
) | 0-58 |
| 171 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 172 | }executed 58 times by 1 test: end of block | 58 |
| 173 | returnexecuted 215 times by 1 test: return (t > i); (t > i);executed 215 times by 1 test: return (t > i); | 215 |
| 174 | } | - |
| 175 | else | - |
| 176 | returnexecuted 48 times by 1 test: return (0); (0);executed 48 times by 1 test: return (0); | 48 |
| 177 | } | - |
| 178 | | - |
| 179 | | - |
| 180 | void | - |
| 181 | bash_initialize_history () | - |
| 182 | { | - |
| 183 | history_quotes_inhibit_expansion = 1; | - |
| 184 | history_search_delimiter_chars = ";&()|<>"; | - |
| 185 | | - |
| 186 | history_inhibit_expansion_function = bash_history_inhibit_expansion; | - |
| 187 | sv_histchars ("histchars"); | - |
| 188 | | - |
| 189 | }executed 31 times by 1 test: end of block | 31 |
| 190 | | - |
| 191 | void | - |
| 192 | bash_history_reinit (interact) | - |
| 193 | int interact; | - |
| 194 | { | - |
| 195 | | - |
| 196 | history_expansion = (| TRUE | evaluated 5461 times by 1 test | | FALSE | never evaluated |
interact == 0)| TRUE | evaluated 5461 times by 1 test | | FALSE | never evaluated |
? histexp_flag : 1; | 0-5461 |
| 197 | history_expansion_inhibited = (| TRUE | evaluated 5461 times by 1 test | | FALSE | never evaluated |
interact == 0)| TRUE | evaluated 5461 times by 1 test | | FALSE | never evaluated |
? 1 - histexp_flag : 0; | 0-5461 |
| 198 | history_inhibit_expansion_function = bash_history_inhibit_expansion; | - |
| 199 | | - |
| 200 | remember_on_history = enable_history_list; | - |
| 201 | }executed 5461 times by 1 test: end of block | 5461 |
| 202 | | - |
| 203 | void | - |
| 204 | bash_history_disable () | - |
| 205 | { | - |
| 206 | remember_on_history = 0; | - |
| 207 | | - |
| 208 | history_expansion_inhibited = 1; | - |
| 209 | | - |
| 210 | }executed 727083 times by 1 test: end of block | 727083 |
| 211 | | - |
| 212 | void | - |
| 213 | bash_history_enable () | - |
| 214 | { | - |
| 215 | remember_on_history = enable_history_list = 1; | - |
| 216 | | - |
| 217 | history_expansion_inhibited = 0; | - |
| 218 | history_inhibit_expansion_function = bash_history_inhibit_expansion; | - |
| 219 | | - |
| 220 | sv_history_control ("HISTCONTROL"); | - |
| 221 | sv_histignore ("HISTIGNORE"); | - |
| 222 | }executed 33 times by 1 test: end of block | 33 |
| 223 | | - |
| 224 | | - |
| 225 | void | - |
| 226 | load_history () | - |
| 227 | { | - |
| 228 | char *hf; | - |
| 229 | | - |
| 230 | | - |
| 231 | | - |
| 232 | | - |
| 233 | | - |
| 234 | set_if_not ("HISTSIZE", "500"); | - |
| 235 | sv_histsize ("HISTSIZE"); | - |
| 236 | | - |
| 237 | set_if_not ("HISTFILESIZE", get_string_value ("HISTSIZE")); | - |
| 238 | sv_histsize ("HISTFILESIZE"); | - |
| 239 | | - |
| 240 | | - |
| 241 | hf = get_string_value ("HISTFILE"); | - |
| 242 | | - |
| 243 | if (hf| TRUE | evaluated 18 times by 1 test | | FALSE | evaluated 15 times by 1 test |
&& *| TRUE | evaluated 18 times by 1 test | | FALSE | never evaluated |
hf| TRUE | evaluated 18 times by 1 test | | FALSE | never evaluated |
&& file_exists (hf)| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 15 times by 1 test |
) | 0-18 |
| 244 | { | - |
| 245 | read_history (hf); | - |
| 246 | | - |
| 247 | | - |
| 248 | | - |
| 249 | | - |
| 250 | history_lines_in_file = history_lines_read_from_file; | - |
| 251 | using_history (); | - |
| 252 | | - |
| 253 | }executed 3 times by 1 test: end of block | 3 |
| 254 | }executed 33 times by 1 test: end of block | 33 |
| 255 | | - |
| 256 | void | - |
| 257 | bash_clear_history () | - |
| 258 | { | - |
| 259 | clear_history (); | - |
| 260 | history_lines_this_session = 0; | - |
| 261 | | - |
| 262 | }executed 6 times by 1 test: end of block | 6 |
| 263 | | - |
| 264 | | - |
| 265 | int | - |
| 266 | bash_delete_histent (i) | - |
| 267 | int i; | - |
| 268 | { | - |
| 269 | HIST_ENTRY *discard; | - |
| 270 | | - |
| 271 | discard = remove_history (i); | - |
| 272 | if (discard| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
) | 0-3 |
| 273 | free_history_entry (discard);executed 3 times by 1 test: free_history_entry (discard); | 3 |
| 274 | history_lines_this_session--; | - |
| 275 | | - |
| 276 | returnexecuted 3 times by 1 test: return 1; 1;executed 3 times by 1 test: return 1; | 3 |
| 277 | } | - |
| 278 | | - |
| 279 | int | - |
| 280 | bash_delete_history_range (first, last) | - |
| 281 | int first, last; | - |
| 282 | { | - |
| 283 | register int i; | - |
| 284 | HIST_ENTRY **discard_list; | - |
| 285 | | - |
| 286 | discard_list = remove_history_range (first, last); | - |
| 287 | for (i = 0; discard_list| TRUE | evaluated 10 times by 1 test | | FALSE | never evaluated |
&& discard_list[i]| TRUE | evaluated 8 times by 1 test | | FALSE | evaluated 2 times by 1 test |
; i++) | 0-10 |
| 288 | free_history_entry (discard_list[i]);executed 8 times by 1 test: free_history_entry (discard_list[i]); | 8 |
| 289 | history_lines_this_session -= i; | - |
| 290 | | - |
| 291 | returnexecuted 2 times by 1 test: return 1; 1;executed 2 times by 1 test: return 1; | 2 |
| 292 | } | - |
| 293 | | - |
| 294 | int | - |
| 295 | bash_delete_last_history () | - |
| 296 | { | - |
| 297 | register int i; | - |
| 298 | HIST_ENTRY **hlist, *histent; | - |
| 299 | int r; | - |
| 300 | | - |
| 301 | hlist = history_list (); | - |
| 302 | if (hlist == | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 303 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 304 | ) | - |
| 305 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 306 | | - |
| 307 | for (i = 0; hlist[i]| TRUE | evaluated 48 times by 1 test | | FALSE | evaluated 3 times by 1 test |
; i++) | 3-48 |
| 308 | ;executed 48 times by 1 test: ; | 48 |
| 309 | i--; | - |
| 310 | | - |
| 311 | | - |
| 312 | histent = history_get (history_base + i); | - |
| 313 | if (histent == | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 314 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 315 | ) | - |
| 316 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 317 | | - |
| 318 | r = bash_delete_histent (i); | - |
| 319 | | - |
| 320 | if (where_history () > history_length| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
) | 0-3 |
| 321 | history_set_pos (history_length);executed 3 times by 1 test: history_set_pos (history_length); | 3 |
| 322 | | - |
| 323 | returnexecuted 3 times by 1 test: return r; r;executed 3 times by 1 test: return r; | 3 |
| 324 | } | - |
| 325 | int | - |
| 326 | maybe_append_history (filename) | - |
| 327 | char *filename; | - |
| 328 | { | - |
| 329 | int fd, result; | - |
| 330 | struct stat buf; | - |
| 331 | | - |
| 332 | result = 0; | - |
| 333 | if (history_lines_this_session > 0| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
&& (| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
history_lines_this_session <= where_history ())| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
) | 0-2 |
| 334 | { | - |
| 335 | | - |
| 336 | if (stat (filename, &buf) == -1| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
&& | 0-2 |
| 337 | (*| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
__errno_location ()) | TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 338 | == | TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 339 | 2| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 340 | ) | - |
| 341 | { | - |
| 342 | fd = open (filename, | - |
| 343 | 01 | - |
| 344 | | | - |
| 345 | 0100 | - |
| 346 | , 0600); | - |
| 347 | if (fd < 0| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
| 348 | { | - |
| 349 | builtin_error ( | - |
| 350 | dcgettext (((void *)0), | - |
| 351 | "%s: cannot create: %s" | - |
| 352 | , 5) | - |
| 353 | , filename, strerror ( | - |
| 354 | (*__errno_location ()) | - |
| 355 | )); | - |
| 356 | return never executed: return (1); (1);never executed: return (1); | 0 |
| 357 | } | - |
| 358 | close (fd); | - |
| 359 | }executed 2 times by 1 test: end of block | 2 |
| 360 | result = append_history (history_lines_this_session, filename); | - |
| 361 | | - |
| 362 | | - |
| 363 | history_lines_in_file += history_lines_this_session; | - |
| 364 | history_lines_this_session = 0; | - |
| 365 | }executed 2 times by 1 test: end of block | 2 |
| 366 | else | - |
| 367 | history_lines_this_session = 0; never executed: history_lines_this_session = 0; | 0 |
| 368 | | - |
| 369 | returnexecuted 2 times by 1 test: return (result); (result);executed 2 times by 1 test: return (result); | 2 |
| 370 | } | - |
| 371 | | - |
| 372 | | - |
| 373 | | - |
| 374 | int | - |
| 375 | maybe_save_shell_history () | - |
| 376 | { | - |
| 377 | int result; | - |
| 378 | char *hf; | - |
| 379 | | - |
| 380 | result = 0; | - |
| 381 | if (history_lines_this_session > 0| TRUE | evaluated 9 times by 1 test | | FALSE | never evaluated |
) | 0-9 |
| 382 | { | - |
| 383 | hf = get_string_value ("HISTFILE"); | - |
| 384 | | - |
| 385 | if (hf| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 6 times by 1 test |
&& *| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
hf| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
) | 0-6 |
| 386 | { | - |
| 387 | | - |
| 388 | if (file_exists (hf) == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 2 times by 1 test |
) | 1-2 |
| 389 | { | - |
| 390 | int file; | - |
| 391 | file = open (hf, | - |
| 392 | 0100 | - |
| 393 | | | - |
| 394 | 01000 | - |
| 395 | | | - |
| 396 | 01 | - |
| 397 | , 0600); | - |
| 398 | if (file != -1| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
) | 0-1 |
| 399 | close (file);executed 1 time by 1 test: close (file); | 1 |
| 400 | }executed 1 time by 1 test: end of block | 1 |
| 401 | | - |
| 402 | | - |
| 403 | | - |
| 404 | | - |
| 405 | using_history (); | - |
| 406 | if (history_lines_this_session <= where_history ()| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
|| force_append_history| TRUE | never evaluated | | FALSE | never evaluated |
) | 0-3 |
| 407 | { | - |
| 408 | result = append_history (history_lines_this_session, hf); | - |
| 409 | history_lines_in_file += history_lines_this_session; | - |
| 410 | }executed 3 times by 1 test: end of block | 3 |
| 411 | else | - |
| 412 | { | - |
| 413 | result = write_history (hf); | - |
| 414 | history_lines_in_file = history_lines_written_to_file; | - |
| 415 | | - |
| 416 | } never executed: end of block | 0 |
| 417 | history_lines_this_session = 0; | - |
| 418 | | - |
| 419 | sv_histsize ("HISTFILESIZE"); | - |
| 420 | }executed 3 times by 1 test: end of block | 3 |
| 421 | }executed 9 times by 1 test: end of block | 9 |
| 422 | returnexecuted 9 times by 1 test: return (result); (result);executed 9 times by 1 test: return (result); | 9 |
| 423 | } | - |
| 424 | | - |
| 425 | | - |
| 426 | | - |
| 427 | static void | - |
| 428 | re_edit (text) | - |
| 429 | char *text; | - |
| 430 | { | - |
| 431 | if (bash_input.type == st_stdin| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 432 | bash_re_edit (text); never executed: bash_re_edit (text); | 0 |
| 433 | } never executed: end of block | 0 |
| 434 | | - |
| 435 | | - |
| 436 | | - |
| 437 | static int | - |
| 438 | history_expansion_p (line) | - |
| 439 | char *line; | - |
| 440 | { | - |
| 441 | register char *s; | - |
| 442 | | - |
| 443 | for (s = line; *| TRUE | evaluated 4393 times by 1 test | | FALSE | evaluated 176 times by 1 test |
s| TRUE | evaluated 4393 times by 1 test | | FALSE | evaluated 176 times by 1 test |
; s++) | 176-4393 |
| 444 | if (*| TRUE | evaluated 205 times by 1 test | | FALSE | evaluated 4188 times by 1 test |
s == history_expansion_char| TRUE | evaluated 205 times by 1 test | | FALSE | evaluated 4188 times by 1 test |
|| *| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 4187 times by 1 test |
s == history_subst_char| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 4187 times by 1 test |
) | 1-4188 |
| 445 | returnexecuted 206 times by 1 test: return 1; 1;executed 206 times by 1 test: return 1; | 206 |
| 446 | returnexecuted 176 times by 1 test: return 0; 0;executed 176 times by 1 test: return 0; | 176 |
| 447 | } | - |
| 448 | char * | - |
| 449 | pre_process_line (line, print_changes, addit) | - |
| 450 | char *line; | - |
| 451 | int print_changes, addit; | - |
| 452 | { | - |
| 453 | char *history_value; | - |
| 454 | char *return_value; | - |
| 455 | int expanded; | - |
| 456 | | - |
| 457 | return_value = line; | - |
| 458 | expanded = 0; | - |
| 459 | | - |
| 460 | | - |
| 461 | | - |
| 462 | | - |
| 463 | if (!history_expansion_inhibited| TRUE | evaluated 491 times by 1 test | | FALSE | never evaluated |
&& history_expansion| TRUE | evaluated 382 times by 1 test | | FALSE | evaluated 109 times by 1 test |
&& history_expansion_p (line)| TRUE | evaluated 206 times by 1 test | | FALSE | evaluated 176 times by 1 test |
) | 0-491 |
| 464 | { | - |
| 465 | expanded = history_expand (line, &history_value); | - |
| 466 | | - |
| 467 | if (expanded| TRUE | evaluated 97 times by 1 test | | FALSE | evaluated 109 times by 1 test |
) | 97-109 |
| 468 | { | - |
| 469 | if (print_changes| TRUE | evaluated 97 times by 1 test | | FALSE | never evaluated |
) | 0-97 |
| 470 | { | - |
| 471 | if (expanded < 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 96 times by 1 test |
) | 1-96 |
| 472 | internal_error ("%s", history_value);executed 1 time by 1 test: internal_error ("%s", history_value); | 1 |
| 473 | | - |
| 474 | else if (hist_verify == 0| TRUE | evaluated 96 times by 1 test | | FALSE | never evaluated |
|| expanded == 2| TRUE | never evaluated | | FALSE | never evaluated |
) | 0-96 |
| 475 | | - |
| 476 | | - |
| 477 | | - |
| 478 | fprintf (executed 96 times by 1 test: fprintf ( stderr , "%s\n", history_value); | 96 |
| 479 | stderrexecuted 96 times by 1 test: fprintf ( stderr , "%s\n", history_value); | 96 |
| 480 | , "%s\n", history_value);executed 96 times by 1 test: fprintf ( stderr , "%s\n", history_value); | 96 |
| 481 | }executed 97 times by 1 test: end of block | 97 |
| 482 | | - |
| 483 | | - |
| 484 | if (expanded < 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 96 times by 1 test |
|| expanded == 2| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 93 times by 1 test |
) | 1-96 |
| 485 | { | - |
| 486 | | - |
| 487 | if (expanded == 2| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 1 time by 1 test |
&& rl_dispatching == 0| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
&& *| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
history_value| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
) | 0-3 |
| 488 | | - |
| 489 | | - |
| 490 | | - |
| 491 | maybe_add_history (history_value);executed 3 times by 1 test: maybe_add_history (history_value); | 3 |
| 492 | | - |
| 493 | sh_xfree((history_value), "bashhist.c", 574); | - |
| 494 | | - |
| 495 | | - |
| 496 | | - |
| 497 | | - |
| 498 | if (history_reediting| TRUE | never evaluated | | FALSE | evaluated 4 times by 1 test |
&& expanded < 0| TRUE | never evaluated | | FALSE | never evaluated |
&& rl_done| TRUE | never evaluated | | FALSE | never evaluated |
) | 0-4 |
| 499 | re_edit (line); never executed: re_edit (line); | 0 |
| 500 | | - |
| 501 | returnexecuted 4 times by 1 test: return ((char *) ((void *)0) ); ((char *)executed 4 times by 1 test: return ((char *) ((void *)0) ); | 4 |
| 502 | ((void *)0)executed 4 times by 1 test: return ((char *) ((void *)0) ); | 4 |
| 503 | );executed 4 times by 1 test: return ((char *) ((void *)0) ); | 4 |
| 504 | } | - |
| 505 | | - |
| 506 | | - |
| 507 | if (hist_verify| TRUE | never evaluated | | FALSE | evaluated 93 times by 1 test |
&& expanded == 1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0-93 |
| 508 | { | - |
| 509 | re_edit (history_value); | - |
| 510 | sh_xfree((history_value), "bashhist.c", 589); | - |
| 511 | return never executed: return ((char *) ((void *)0) ); ((char *)never executed: return ((char *) ((void *)0) ); | 0 |
| 512 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 |
| 513 | ); never executed: return ((char *) ((void *)0) ); | 0 |
| 514 | } | - |
| 515 | | - |
| 516 | }executed 93 times by 1 test: end of block | 93 |
| 517 | | - |
| 518 | | - |
| 519 | | - |
| 520 | | - |
| 521 | expanded = 1; | - |
| 522 | return_value = history_value; | - |
| 523 | }executed 202 times by 1 test: end of block | 202 |
| 524 | | - |
| 525 | | - |
| 526 | if (addit| TRUE | evaluated 487 times by 1 test | | FALSE | never evaluated |
&& remember_on_history| TRUE | evaluated 487 times by 1 test | | FALSE | never evaluated |
&& *| TRUE | evaluated 487 times by 1 test | | FALSE | never evaluated |
return_value| TRUE | evaluated 487 times by 1 test | | FALSE | never evaluated |
) | 0-487 |
| 527 | maybe_add_history (return_value);executed 487 times by 1 test: maybe_add_history (return_value); | 487 |
| 528 | | - |
| 529 | | - |
| 530 | | - |
| 531 | | - |
| 532 | | - |
| 533 | | - |
| 534 | returnexecuted 487 times by 1 test: return (return_value); (return_value);executed 487 times by 1 test: return (return_value); | 487 |
| 535 | } | - |
| 536 | | - |
| 537 | | - |
| 538 | | - |
| 539 | | - |
| 540 | | - |
| 541 | static int | - |
| 542 | shell_comment (line) | - |
| 543 | char *line; | - |
| 544 | { | - |
| 545 | char *p; | - |
| 546 | int n; | - |
| 547 | | - |
| 548 | if (line == 0| TRUE | never evaluated | | FALSE | evaluated 506 times by 1 test |
) | 0-506 |
| 549 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 550 | for (p = line; p| TRUE | evaluated 508 times by 1 test | | FALSE | never evaluated |
&& *| TRUE | evaluated 508 times by 1 test | | FALSE | never evaluated |
p| TRUE | evaluated 508 times by 1 test | | FALSE | never evaluated |
&& (((*| TRUE | never evaluated | | FALSE | evaluated 508 times by 1 test |
p) == ' ')| TRUE | never evaluated | | FALSE | evaluated 508 times by 1 test |
|| ((*| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 506 times by 1 test |
p) == '\t')| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 506 times by 1 test |
); p++) | 0-508 |
| 551 | ;executed 2 times by 1 test: ; | 2 |
| 552 | if (p| TRUE | evaluated 506 times by 1 test | | FALSE | never evaluated |
&& *| TRUE | evaluated 25 times by 1 test | | FALSE | evaluated 481 times by 1 test |
p == '#'| TRUE | evaluated 25 times by 1 test | | FALSE | evaluated 481 times by 1 test |
) | 0-506 |
| 553 | returnexecuted 25 times by 1 test: return 1; 1;executed 25 times by 1 test: return 1; | 25 |
| 554 | n = skip_to_delim (line, p - line, "#", 0x001|0x040|0x010|0x100); | - |
| 555 | returnexecuted 481 times by 1 test: return (line[n] == '#') ? 2 : 0; (line[n] == '#') ? 2 : 0;executed 481 times by 1 test: return (line[n] == '#') ? 2 : 0; | 481 |
| 556 | } | - |
| 557 | static int | - |
| 558 | check_history_control (line) | - |
| 559 | char *line; | - |
| 560 | { | - |
| 561 | HIST_ENTRY *temp; | - |
| 562 | int r; | - |
| 563 | | - |
| 564 | if (history_control == 0| TRUE | evaluated 342 times by 1 test | | FALSE | evaluated 149 times by 1 test |
) | 149-342 |
| 565 | returnexecuted 342 times by 1 test: return 1; 1;executed 342 times by 1 test: return 1; | 342 |
| 566 | | - |
| 567 | | - |
| 568 | if ((| TRUE | evaluated 149 times by 1 test | | FALSE | never evaluated |
history_control & 0x01)| TRUE | evaluated 149 times by 1 test | | FALSE | never evaluated |
&& *| TRUE | never evaluated | | FALSE | evaluated 149 times by 1 test |
line == ' '| TRUE | never evaluated | | FALSE | evaluated 149 times by 1 test |
) | 0-149 |
| 569 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 570 | | - |
| 571 | | - |
| 572 | if (history_control & 0x02| TRUE | evaluated 149 times by 1 test | | FALSE | never evaluated |
) | 0-149 |
| 573 | { | - |
| 574 | using_history (); | - |
| 575 | temp = previous_history (); | - |
| 576 | | - |
| 577 | r = (temp == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 148 times by 1 test |
|| ((| TRUE | evaluated 63 times by 1 test | | FALSE | evaluated 85 times by 1 test |
temp->line)[0] == (line)[0]| TRUE | evaluated 63 times by 1 test | | FALSE | evaluated 85 times by 1 test |
&& | TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 1-148 |
| 578 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 579 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 580 | ) && __builtin_constant_p (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 581 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 582 | ) && (__s1_len = __builtin_strlen (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 583 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 584 | ), __s2_len = __builtin_strlen (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 585 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 586 | ), (!((size_t)(const void *)((| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 587 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 588 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 589 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 590 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 591 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 592 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 593 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 594 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 595 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 596 | , | TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 597 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 598 | ) : (__builtin_constant_p (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 599 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 600 | ) && ((size_t)(const void *)((| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 601 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 602 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 603 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 604 | ) == 1) && (__s1_len = __builtin_strlen (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 605 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 606 | ), __s1_len < 4) ? (__builtin_constant_p (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 607 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 608 | ) && ((size_t)(const void *)((| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 609 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 610 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 611 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 612 | ) == 1) ? __builtin_strcmp (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 613 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 614 | , | TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 615 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 616 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 617 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 618 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 619 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 620 | ))[0] - __s2[0]); if (__s1_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 0-137 |
| 621 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 622 | ))[1] - __s2[1]); if (__s1_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 0-137 |
| 623 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 624 | ))[2] - __s2[2]); if (__s1_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( temp->line ))[3] - __s2[3]); | TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 0-137 |
| 625 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( temp->line ))[3] - __s2[3]); | 0-137 |
| 626 | ))[3] - __s2[3]);| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( temp->line ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 0-137 |
| 627 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 628 | ) && ((size_t)(const void *)((| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 629 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 630 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 631 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 632 | ) == 1) && (__s2_len = __builtin_strlen (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 633 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 634 | ), __s2_len < 4) ? (__builtin_constant_p (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 635 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 636 | ) && ((size_t)(const void *)((| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 637 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 638 | ) + 1) - (size_t)(const void *)(| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 639 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 640 | ) == 1) ? __builtin_strcmp (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 641 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 642 | , | TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 643 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 644 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 645 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 646 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 647 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 648 | ))[0] - __s2[0]); if (__s2_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 0-137 |
| 649 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 650 | ))[1] - __s2[1]); if (__s2_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 0-137 |
| 651 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 652 | ))[2] - __s2[2]); if (__s2_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( line ))[3] - __s2[3]); | TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 0-137 |
| 653 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( line ))[3] - __s2[3]); | 0-137 |
| 654 | ))[3] - __s2[3]);| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( line ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 0-137 |
| 655 | temp->line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 656 | , | TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 657 | line| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 658 | )))); }) | TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-137 |
| 659 | == 0| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 52 times by 1 test |
) == 0| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 11 times by 1 test |
); | 11-137 |
| 660 | | - |
| 661 | using_history (); | - |
| 662 | | - |
| 663 | if (r == 0| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 138 times by 1 test |
) | 11-138 |
| 664 | returnexecuted 11 times by 1 test: return r; r;executed 11 times by 1 test: return r; | 11 |
| 665 | }executed 138 times by 1 test: end of block | 138 |
| 666 | | - |
| 667 | returnexecuted 138 times by 1 test: return 1; 1;executed 138 times by 1 test: return 1; | 138 |
| 668 | } | - |
| 669 | | - |
| 670 | | - |
| 671 | | - |
| 672 | static void | - |
| 673 | hc_erasedups (line) | - |
| 674 | char *line; | - |
| 675 | { | - |
| 676 | HIST_ENTRY *temp; | - |
| 677 | int r; | - |
| 678 | | - |
| 679 | using_history (); | - |
| 680 | while (temp = previous_history ()| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 681 | { | - |
| 682 | if (((| TRUE | never evaluated | | FALSE | never evaluated |
temp->line)[0] == (line)[0]| TRUE | never evaluated | | FALSE | never evaluated |
&& | 0 |
| 683 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 684 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 685 | ) && __builtin_constant_p (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 686 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 687 | ) && (__s1_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 688 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 689 | ), __s2_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 690 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 691 | ), (!((size_t)(const void *)((| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 692 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 693 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 694 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 695 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 696 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 697 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 698 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 699 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 700 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 701 | , | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 702 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 703 | ) : (__builtin_constant_p (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 704 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 705 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 706 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 707 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 708 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 709 | ) == 1) && (__s1_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 710 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 711 | ), __s1_len < 4) ? (__builtin_constant_p (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 712 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 713 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 714 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 715 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 716 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 717 | ) == 1) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 718 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 719 | , | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 720 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 721 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 722 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 723 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 724 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 725 | ))[0] - __s2[0]); if (__s1_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 726 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 727 | ))[1] - __s2[1]); if (__s1_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 728 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 729 | ))[2] - __s2[2]); if (__s1_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( temp->line ))[3] - __s2[3]); | 0 |
| 730 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( temp->line ))[3] - __s2[3]); | 0 |
| 731 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 732 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 733 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 734 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 735 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 736 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 737 | ) == 1) && (__s2_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 738 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 739 | ), __s2_len < 4) ? (__builtin_constant_p (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 740 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 741 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 742 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 743 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 744 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 745 | ) == 1) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 746 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 747 | , | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 748 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 749 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 750 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 751 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 752 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 753 | ))[0] - __s2[0]); if (__s2_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 754 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 755 | ))[1] - __s2[1]); if (__s2_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 756 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 757 | ))[2] - __s2[2]); if (__s2_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( line ))[3] - __s2[3]); | 0 |
| 758 | line| TRUE | never evaluated | | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( line ))[3] - __s2[3]); | 0 |
| 759 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 760 | temp->line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 761 | , | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 762 | line| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 763 | )))); }) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 764 | == 0| TRUE | never evaluated | | FALSE | never evaluated |
)) | 0 |
| 765 | { | - |
| 766 | r = where_history (); | - |
| 767 | temp = remove_history (r); | - |
| 768 | if (temp| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 769 | free_history_entry (temp); never executed: free_history_entry (temp); | 0 |
| 770 | } never executed: end of block | 0 |
| 771 | } never executed: end of block | 0 |
| 772 | using_history (); | - |
| 773 | } never executed: end of block | 0 |
| 774 | void | - |
| 775 | maybe_add_history (line) | - |
| 776 | char *line; | - |
| 777 | { | - |
| 778 | int is_comment; | - |
| 779 | | - |
| 780 | hist_last_line_added = 0; | - |
| 781 | is_comment = shell_comment (line); | - |
| 782 | | - |
| 783 | | - |
| 784 | | - |
| 785 | | - |
| 786 | if (current_command_line_count > 1| TRUE | evaluated 9 times by 1 test | | FALSE | evaluated 488 times by 1 test |
) | 9-488 |
| 787 | { | - |
| 788 | if (current_command_first_line_saved| TRUE | evaluated 9 times by 1 test | | FALSE | never evaluated |
&& | 0-9 |
| 789 | ((| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 5 times by 1 test |
parser_state & 0x020000)| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 5 times by 1 test |
|| literal_history| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
|| dstack.delimiter_depth != 0| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
|| is_comment != 1| TRUE | evaluated 5 times by 1 test | | FALSE | never evaluated |
)) | 0-5 |
| 790 | bash_add_history (line);executed 9 times by 1 test: bash_add_history (line); | 9 |
| 791 | current_command_line_comment = is_comment| TRUE | never evaluated | | FALSE | evaluated 9 times by 1 test |
? current_command_line_count : -2; | 0-9 |
| 792 | return;executed 9 times by 1 test: return; | 9 |
| 793 | } | - |
| 794 | | - |
| 795 | | - |
| 796 | | - |
| 797 | current_command_line_comment = is_comment| TRUE | evaluated 26 times by 1 test | | FALSE | evaluated 462 times by 1 test |
? current_command_line_count : -2; | 26-462 |
| 798 | current_command_first_line_saved = check_add_history (line, 0); | - |
| 799 | }executed 488 times by 1 test: end of block | 488 |
| 800 | | - |
| 801 | | - |
| 802 | | - |
| 803 | | - |
| 804 | int | - |
| 805 | check_add_history (line, force) | - |
| 806 | char *line; | - |
| 807 | int force; | - |
| 808 | { | - |
| 809 | if (check_history_control (line)| TRUE | evaluated 480 times by 1 test | | FALSE | evaluated 11 times by 1 test |
&& history_should_ignore (line) == 0| TRUE | evaluated 430 times by 1 test | | FALSE | evaluated 50 times by 1 test |
) | 11-480 |
| 810 | { | - |
| 811 | | - |
| 812 | | - |
| 813 | if (history_control & 0x04| TRUE | never evaluated | | FALSE | evaluated 430 times by 1 test |
) | 0-430 |
| 814 | hc_erasedups (line); never executed: hc_erasedups (line); | 0 |
| 815 | | - |
| 816 | if (force| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 427 times by 1 test |
) | 3-427 |
| 817 | { | - |
| 818 | really_add_history (line); | - |
| 819 | using_history (); | - |
| 820 | }executed 3 times by 1 test: end of block | 3 |
| 821 | else | - |
| 822 | bash_add_history (line);executed 427 times by 1 test: bash_add_history (line); | 427 |
| 823 | returnexecuted 430 times by 1 test: return 1; 1;executed 430 times by 1 test: return 1; | 430 |
| 824 | } | - |
| 825 | returnexecuted 61 times by 1 test: return 0; 0;executed 61 times by 1 test: return 0; | 61 |
| 826 | } | - |
| 827 | void | - |
| 828 | bash_add_history (line) | - |
| 829 | char *line; | - |
| 830 | { | - |
| 831 | int add_it, offset, curlen; | - |
| 832 | HIST_ENTRY *current, *old; | - |
| 833 | char *chars_to_add, *new_line; | - |
| 834 | | - |
| 835 | add_it = 1; | - |
| 836 | if (command_oriented_history| TRUE | evaluated 436 times by 1 test | | FALSE | never evaluated |
&& current_command_line_count > 1| TRUE | evaluated 9 times by 1 test | | FALSE | evaluated 427 times by 1 test |
) | 0-436 |
| 837 | { | - |
| 838 | | - |
| 839 | | - |
| 840 | | - |
| 841 | | - |
| 842 | | - |
| 843 | | - |
| 844 | | - |
| 845 | if ((| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 5 times by 1 test |
parser_state & 0x020000)| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 5 times by 1 test |
&& literal_history| TRUE | never evaluated | | FALSE | evaluated 4 times by 1 test |
&& current_command_line_count > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& line[strlen (line) - 1] == '\n'| TRUE | never evaluated | | FALSE | never evaluated |
) | 0-5 |
| 846 | chars_to_add = ""; never executed: chars_to_add = ""; | 0 |
| 847 | else if (current_command_line_count == current_command_line_comment+1| TRUE | never evaluated | | FALSE | evaluated 9 times by 1 test |
) | 0-9 |
| 848 | chars_to_add = "\n"; never executed: chars_to_add = "\n"; | 0 |
| 849 | else if (literal_history| TRUE | never evaluated | | FALSE | evaluated 9 times by 1 test |
) | 0-9 |
| 850 | chars_to_add = "\n"; never executed: chars_to_add = "\n"; | 0 |
| 851 | else | - |
| 852 | chars_to_add = history_delimiting_chars (line);executed 9 times by 1 test: chars_to_add = history_delimiting_chars (line); | 9 |
| 853 | | - |
| 854 | using_history (); | - |
| 855 | current = previous_history (); | - |
| 856 | | - |
| 857 | current_command_line_comment = shell_comment (line)| TRUE | never evaluated | | FALSE | evaluated 9 times by 1 test |
? current_command_line_count : -2; | 0-9 |
| 858 | | - |
| 859 | if (current| TRUE | evaluated 9 times by 1 test | | FALSE | never evaluated |
) | 0-9 |
| 860 | { | - |
| 861 | | - |
| 862 | | - |
| 863 | | - |
| 864 | curlen = strlen (current->line); | - |
| 865 | | - |
| 866 | if (dstack.delimiter_depth == 0| TRUE | evaluated 9 times by 1 test | | FALSE | never evaluated |
&& current->line[curlen - 1] == '\\'| TRUE | never evaluated | | FALSE | evaluated 9 times by 1 test |
&& | 0-9 |
| 867 | current->line[curlen - 2] != '\\'| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 868 | { | - |
| 869 | current->line[curlen - 1] = '\0'; | - |
| 870 | curlen--; | - |
| 871 | chars_to_add = ""; | - |
| 872 | } never executed: end of block | 0 |
| 873 | | - |
| 874 | | - |
| 875 | | - |
| 876 | | - |
| 877 | | - |
| 878 | if (dstack.delimiter_depth == 0| TRUE | evaluated 9 times by 1 test | | FALSE | never evaluated |
&& current->line[curlen - 1] == '\n'| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 6 times by 1 test |
&& *| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
chars_to_add == ';'| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
) | 0-9 |
| 879 | chars_to_add++; never executed: chars_to_add++; | 0 |
| 880 | | - |
| 881 | new_line = (char *)sh_xmalloc((1 + curlen + strlen (line) + strlen (chars_to_add)), | - |
| 882 | | - |
| 883 | | - |
| 884 | "bashhist.c" | - |
| 885 | , | - |
| 886 | | - |
| 887 | | - |
| 888 | 869 | - |
| 889 | ) | - |
| 890 | | - |
| 891 | | - |
| 892 | ; | - |
| 893 | sprintf (new_line, "%s%s%s", current->line, chars_to_add, line); | - |
| 894 | offset = where_history (); | - |
| 895 | old = replace_history_entry (offset, new_line, current->data); | - |
| 896 | sh_xfree((new_line), "bashhist.c", 873); | - |
| 897 | | - |
| 898 | if (old| TRUE | evaluated 9 times by 1 test | | FALSE | never evaluated |
) | 0-9 |
| 899 | free_history_entry (old);executed 9 times by 1 test: free_history_entry (old); | 9 |
| 900 | | - |
| 901 | add_it = 0; | - |
| 902 | }executed 9 times by 1 test: end of block | 9 |
| 903 | }executed 9 times by 1 test: end of block | 9 |
| 904 | | - |
| 905 | if (add_it| TRUE | evaluated 427 times by 1 test | | FALSE | evaluated 9 times by 1 test |
) | 9-427 |
| 906 | really_add_history (line);executed 427 times by 1 test: really_add_history (line); | 427 |
| 907 | | - |
| 908 | | - |
| 909 | | - |
| 910 | | - |
| 911 | | - |
| 912 | using_history (); | - |
| 913 | }executed 436 times by 1 test: end of block | 436 |
| 914 | | - |
| 915 | static void | - |
| 916 | really_add_history (line) | - |
| 917 | char *line; | - |
| 918 | { | - |
| 919 | hist_last_line_added = 1; | - |
| 920 | hist_last_line_pushed = 0; | - |
| 921 | add_history (line); | - |
| 922 | history_lines_this_session++; | - |
| 923 | }executed 430 times by 1 test: end of block | 430 |
| 924 | | - |
| 925 | int | - |
| 926 | history_number () | - |
| 927 | { | - |
| 928 | using_history (); | - |
| 929 | return never executed: return (remember_on_history ? history_base + where_history () : 1); (remember_on_history ? history_base + where_history () : 1);never executed: return (remember_on_history ? history_base + where_history () : 1); | 0 |
| 930 | } | - |
| 931 | | - |
| 932 | static int | - |
| 933 | should_expand (s) | - |
| 934 | char *s; | - |
| 935 | { | - |
| 936 | char *p; | - |
| 937 | | - |
| 938 | for (p = s; p| TRUE | evaluated 31 times by 1 test | | FALSE | never evaluated |
&& *| TRUE | evaluated 26 times by 1 test | | FALSE | evaluated 5 times by 1 test |
p| TRUE | evaluated 26 times by 1 test | | FALSE | evaluated 5 times by 1 test |
; p++) | 0-31 |
| 939 | { | - |
| 940 | if (*| TRUE | never evaluated | | FALSE | evaluated 26 times by 1 test |
p == '\\'| TRUE | never evaluated | | FALSE | evaluated 26 times by 1 test |
) | 0-26 |
| 941 | p++; never executed: p++; | 0 |
| 942 | else if (*| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 24 times by 1 test |
p == '&'| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 24 times by 1 test |
) | 2-24 |
| 943 | returnexecuted 2 times by 1 test: return 1; 1;executed 2 times by 1 test: return 1; | 2 |
| 944 | }executed 24 times by 1 test: end of block | 24 |
| 945 | returnexecuted 5 times by 1 test: return 0; 0;executed 5 times by 1 test: return 0; | 5 |
| 946 | } | - |
| 947 | | - |
| 948 | static int | - |
| 949 | histignore_item_func (ign) | - |
| 950 | struct ign *ign; | - |
| 951 | { | - |
| 952 | if (should_expand (ign->val)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 5 times by 1 test |
) | 2-5 |
| 953 | ign->flags |= 0x01;executed 2 times by 1 test: ign->flags |= 0x01; | 2 |
| 954 | returnexecuted 7 times by 1 test: return (0); (0);executed 7 times by 1 test: return (0); | 7 |
| 955 | } | - |
| 956 | | - |
| 957 | void | - |
| 958 | setup_history_ignore (varname) | - |
| 959 | char *varname; | - |
| 960 | { | - |
| 961 | setup_ignore_patterns (&histignore); | - |
| 962 | }executed 38 times by 1 test: end of block | 38 |
| 963 | | - |
| 964 | static HIST_ENTRY * | - |
| 965 | last_history_entry () | - |
| 966 | { | - |
| 967 | HIST_ENTRY *he; | - |
| 968 | | - |
| 969 | using_history (); | - |
| 970 | he = previous_history (); | - |
| 971 | using_history (); | - |
| 972 | returnexecuted 137 times by 1 test: return he; he;executed 137 times by 1 test: return he; | 137 |
| 973 | } | - |
| 974 | | - |
| 975 | char * | - |
| 976 | last_history_line () | - |
| 977 | { | - |
| 978 | HIST_ENTRY *he; | - |
| 979 | | - |
| 980 | he = last_history_entry (); | - |
| 981 | if (he == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 982 | return never executed: return ((char *) ((void *)0) ); ((char *)never executed: return ((char *) ((void *)0) ); | 0 |
| 983 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 |
| 984 | ); never executed: return ((char *) ((void *)0) ); | 0 |
| 985 | return never executed: return he->line; he->line;never executed: return he->line; | 0 |
| 986 | } | - |
| 987 | | - |
| 988 | static char * | - |
| 989 | expand_histignore_pattern (pat) | - |
| 990 | char *pat; | - |
| 991 | { | - |
| 992 | HIST_ENTRY *phe; | - |
| 993 | char *ret; | - |
| 994 | | - |
| 995 | phe = last_history_entry (); | - |
| 996 | | - |
| 997 | if (phe == (HIST_ENTRY *)0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 136 times by 1 test |
) | 1-136 |
| 998 | returnexecuted 1 time by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (pat)), "bashhist.c", 973), (pat))); ((char *)strcpy (sh_xmalloc((1 + strlen (pat)), "bashhist.c", 973), (pat)));executed 1 time by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (pat)), "bashhist.c", 973), (pat))); | 1 |
| 999 | | - |
| 1000 | ret = strcreplace (pat, '&', phe->line, 1); | - |
| 1001 | | - |
| 1002 | returnexecuted 136 times by 1 test: return ret; ret;executed 136 times by 1 test: return ret; | 136 |
| 1003 | } | - |
| 1004 | | - |
| 1005 | | - |
| 1006 | | - |
| 1007 | static int | - |
| 1008 | history_should_ignore (line) | - |
| 1009 | char *line; | - |
| 1010 | { | - |
| 1011 | register int i, match; | - |
| 1012 | char *npat; | - |
| 1013 | | - |
| 1014 | if (histignore.num_ignores == 0| TRUE | evaluated 343 times by 1 test | | FALSE | evaluated 137 times by 1 test |
) | 137-343 |
| 1015 | returnexecuted 343 times by 1 test: return 0; 0;executed 343 times by 1 test: return 0; | 343 |
| 1016 | | - |
| 1017 | for (i = match = 0; i < histignore.num_ignores| TRUE | evaluated 437 times by 1 test | | FALSE | evaluated 87 times by 1 test |
; i++) | 87-437 |
| 1018 | { | - |
| 1019 | if (histignore.ignores[i].flags & 0x01| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 300 times by 1 test |
) | 137-300 |
| 1020 | npat = expand_histignore_pattern (histignore.ignores[i].val);executed 137 times by 1 test: npat = expand_histignore_pattern (histignore.ignores[i].val); | 137 |
| 1021 | else | - |
| 1022 | npat = histignore.ignores[i].val;executed 300 times by 1 test: npat = histignore.ignores[i].val; | 300 |
| 1023 | | - |
| 1024 | match = strmatch (npat, line, (extended_glob ? (1 << 5) : 0)) != 1; | - |
| 1025 | | - |
| 1026 | if (histignore.ignores[i].flags & 0x01| TRUE | evaluated 137 times by 1 test | | FALSE | evaluated 300 times by 1 test |
) | 137-300 |
| 1027 | sh_xfree((npat), "bashhist.c", 1002);executed 137 times by 1 test: sh_xfree((npat), "bashhist.c", 1002); | 137 |
| 1028 | | - |
| 1029 | if (match| TRUE | evaluated 50 times by 1 test | | FALSE | evaluated 387 times by 1 test |
) | 50-387 |
| 1030 | break;executed 50 times by 1 test: break; | 50 |
| 1031 | }executed 387 times by 1 test: end of block | 387 |
| 1032 | | - |
| 1033 | returnexecuted 137 times by 1 test: return match; match;executed 137 times by 1 test: return match; | 137 |
| 1034 | } | - |
| | |