aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-06 14:27:49 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-06 14:27:49 -0400
commit817235cfbc3162e136d53ec5bffe234d4d87c79b (patch)
tree19574d92469dd4e4c5e472c979d095f54965b530
parent7b57090564e6f2fe4e2de686f6c76eb0d5744274 (diff)
Check for .tm file extension
-rw-r--r--tomo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tomo.c b/tomo.c
index 728fb745..d30afc14 100644
--- a/tomo.c
+++ b/tomo.c
@@ -130,6 +130,8 @@ int main(int argc, char *argv[])
Table_t argument_files = {};
for (int i = after_flags; i < argc; i++) {
+ if (strlen(argv[i]) < 4 || strncmp(argv[i] + strlen(argv[i]) - 3, ".tm", 3) != 0)
+ errx(1, "Not a valid .tm file: \x1b[31;1m%s\x1b[m", argv[i]);
const char *resolved = resolve_path(argv[i], ".", ".");
if (!resolved) errx(1, "Couldn't resolve path: %s", argv[i]);
Table$str_set(&argument_files, resolved, argv[i]);