* \i and \ir -- include a file */
| 1596 | * \i and \ir -- include a file |
| 1597 | */ |
| 1598 | static backslashResult |
| 1599 | exec_command_include(PsqlScanState scan_state, bool active_branch, const char *cmd) |
| 1600 | { |
| 1601 | bool success = true; |
| 1602 | |
| 1603 | if (active_branch) |
| 1604 | { |
| 1605 | char *fname = psql_scan_slash_option(scan_state, |
| 1606 | OT_NORMAL, NULL, true); |
| 1607 | |
| 1608 | if (!fname) |
| 1609 | { |
| 1610 | pg_log_error("\\%s: missing required argument", cmd); |
| 1611 | success = false; |
| 1612 | } |
| 1613 | else |
| 1614 | { |
| 1615 | bool include_relative; |
| 1616 | |
| 1617 | include_relative = (strcmp(cmd, "ir") == 0 |
| 1618 | || strcmp(cmd, "include_relative") == 0); |
| 1619 | expand_tilde(&fname); |
| 1620 | success = (process_file(fname, include_relative) == EXIT_SUCCESS); |
| 1621 | free(fname); |
| 1622 | } |
| 1623 | } |
| 1624 | else |
| 1625 | ignore_slash_options(scan_state); |
| 1626 | |
| 1627 | return success ? PSQL_CMD_SKIP_LINE : PSQL_CMD_ERROR; |
| 1628 | } |
| 1629 | |
| 1630 | /* |
| 1631 | * \if <expr> -- beginning of an \if..\endif block |
no test coverage detected