2026-10-26 23:07:03 +01:00
|
|
|
#include "xtc/xtc.h"
|
|
|
|
|
#include "xtc/xtc_version.h"
|
2026-10-26 23:03:17 +01:00
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
2026-10-27 01:21:04 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
#include "xtc/xtc_project.h"
|
2026-10-26 23:03:17 +01:00
|
|
|
|
2026-10-27 01:21:04 +01:00
|
|
|
int main(int argc, char **argv)
|
2026-10-26 23:03:17 +01:00
|
|
|
{
|
2026-10-27 01:21:04 +01:00
|
|
|
if (argc == 2 && !strcmp(argv[1], "--version")) {
|
2026-10-27 01:37:21 +01:00
|
|
|
printf("%s %s\n", XTC_PROJECT_NAME, XTC_VERSION_STRING);
|
|
|
|
|
return EXIT_SUCCESS;
|
2026-10-27 01:21:04 +01:00
|
|
|
}
|
|
|
|
|
if (argc == 2 && !strcmp(argv[1], "--help")) {
|
2026-10-27 01:37:21 +01:00
|
|
|
puts("Usage: xtc-check [--version | --help | --validate PROJECT]\nNo arguments checks core startup/shutdown. "
|
|
|
|
|
"Validation checks metadata only.");
|
|
|
|
|
return EXIT_SUCCESS;
|
2026-10-27 01:21:04 +01:00
|
|
|
}
|
|
|
|
|
if (argc == 3 && !strcmp(argv[1], "--validate")) {
|
|
|
|
|
xtc_project *project = NULL;
|
|
|
|
|
xtc_result result = xtc_project_create(&project);
|
2026-10-27 01:37:21 +01:00
|
|
|
if (result == XTC_OK)
|
|
|
|
|
result = xtc_project_load(project, argv[2]);
|
2026-10-27 01:21:04 +01:00
|
|
|
xtc_project_destroy(project);
|
2026-10-27 01:37:21 +01:00
|
|
|
if (result != XTC_OK) {
|
|
|
|
|
fprintf(stderr, "Project validation failed: %s\n", xtc_result_string(result));
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
puts("Project metadata valid (external assets not loaded).");
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
if (argc != 1) {
|
|
|
|
|
fputs("Usage: xtc-check [--version | --help | --validate PROJECT]\n", stderr);
|
|
|
|
|
return EXIT_FAILURE;
|
2026-10-27 01:21:04 +01:00
|
|
|
}
|
|
|
|
|
|
2026-10-26 23:20:00 +01:00
|
|
|
xtc_app *app = NULL;
|
|
|
|
|
xtc_result result = xtc_app_create(&app);
|
2026-10-26 23:03:17 +01:00
|
|
|
|
2026-10-26 23:20:00 +01:00
|
|
|
if (result != XTC_OK) {
|
2026-10-27 01:37:21 +01:00
|
|
|
(void)fprintf(stderr, "Application initialization failed: %s\n", xtc_result_string(result));
|
2026-10-26 23:03:17 +01:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-26 23:20:00 +01:00
|
|
|
xtc_app_destroy(app);
|
2026-10-27 01:37:21 +01:00
|
|
|
if (printf("%s %s: core startup/shutdown OK\n", XTC_PROJECT_NAME, XTC_VERSION_STRING) < 0) {
|
2026-10-26 23:03:17 +01:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
|
}
|