summaryrefslogtreecommitdiff
path: root/core/cescal.c
diff options
context:
space:
mode:
authorIan Moffett <ian@mirocom.org>2026-05-23 01:28:05 -0400
committerIan Moffett <ian@mirocom.org>2026-05-23 01:28:05 -0400
commitc5f8f95059504748f07e0d3ca9d978669622428c (patch)
treecc64c48bb1e93c2df466f4fb007912628c319c91 /core/cescal.c
initial commit
Signed-off-by: Ian Moffett <ian@mirocom.org>
Diffstat (limited to 'core/cescal.c')
-rw-r--r--core/cescal.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/core/cescal.c b/core/cescal.c
new file mode 100644
index 0000000..b9a2c17
--- /dev/null
+++ b/core/cescal.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2026, Chloe M.
+ * Provided under the BSD-3 clause
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include "cescal/state.h"
+
+static void
+help(void)
+{
+ printf("usage: ./cescal [flags]\n");
+ printf("[-h] Display this help menu\n");
+}
+
+static int
+compile(const char *pathname)
+{
+ struct cescal_state st;
+
+ if (pathname == NULL) {
+ return -1;
+ }
+
+ if (state_init(&st, pathname) < 0) {
+ return -1;
+ }
+
+ state_close(&st);
+ return 0;
+}
+
+int
+main(int argc, char **argv)
+{
+ int opt;
+
+ if (argc < 2) {
+ printf("fatal: too few arguments\n");
+ help();
+ return -1;
+ }
+
+ while ((opt = getopt(argc, argv, "h")) != -1) {
+ switch (opt) {
+ case 'h':
+ help();
+ return -1;
+ }
+ }
+
+ while (optind < argc) {
+ if (compile(argv[optind++]) < 0) {
+ break;
+ }
+ }
+
+ return 0;
+}