| 7527 | } |
| 7528 | |
| 7529 | static bool prepare_config_parent(const char *path) { |
| 7530 | if (!path || !path[0]) { |
| 7531 | return false; |
| 7532 | } |
| 7533 | char parent[CLI_BUF_1K]; |
| 7534 | int written = snprintf(parent, sizeof(parent), "%s", path); |
| 7535 | if (written < 0 || (size_t)written >= sizeof(parent)) { |
| 7536 | return false; |
| 7537 | } |
| 7538 | char *slash = strrchr(parent, '/'); |
| 7539 | char *backslash = strrchr(parent, '\\'); |
| 7540 | if (backslash && (!slash || backslash > slash)) { |
| 7541 | slash = backslash; |
| 7542 | } |
| 7543 | if (!slash || slash == parent) { |
| 7544 | return slash != NULL; |
| 7545 | } |
| 7546 | *slash = '\0'; |
| 7547 | return cbm_mkdir_p(parent, CLI_OCTAL_PERM); |
| 7548 | } |
| 7549 | |
| 7550 | typedef struct { |
| 7551 | const char *label; |
no test coverage detected