Add the most recently read line of input to the block already stored. */
| 1568 | |
| 1569 | /* Add the most recently read line of input to the block already stored. */ |
| 1570 | static int append_args(ffio *G) { |
| 1571 | size_t skip_chars = 0; |
| 1572 | size_t next_len = strlen(G->next_args); |
| 1573 | size_t args_len = strlen(G->args); |
| 1574 | const char *tag = at_tag(G); |
| 1575 | |
| 1576 | if (tag) |
| 1577 | skip_chars = strlen(tag); |
| 1578 | |
| 1579 | /* +2: 1 for the space separator and 1 for the NUL termination. */ |
| 1580 | if (G->args_size < args_len + next_len - skip_chars + 2) { |
| 1581 | char *p = static_cast<char *>(realloc(G->args, 2 * G->args_size)); |
| 1582 | if (nullptr == p) |
| 1583 | return 0; |
| 1584 | G->args = p; |
| 1585 | G->args_size = 2 * G->args_size; |
| 1586 | } |
| 1587 | |
| 1588 | G->args[args_len] = ' '; |
| 1589 | strcpy(G->args + args_len + 1, G->next_args + skip_chars); |
| 1590 | |
| 1591 | G->next_args[0] = 0; |
| 1592 | return 1; |
| 1593 | } |
| 1594 | |
| 1595 | /***************************************************************************************/ |
| 1596 | static int get_inp(ffio *G) { |