From 414fbf721478dc3443d93caef57cda823923c7c7 Mon Sep 17 00:00:00 2001 From: vx-clutch Date: Thu, 17 Jul 2025 21:13:43 -0400 Subject: [PATCH] fix: start migration to comply with GNU style --- Makefile | 4 ++-- config.h | 1 - core/standard.c | 31 ++++++++++--------------------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 4c6218f..dcf5d85 100644 --- a/Makefile +++ b/Makefile @@ -20,10 +20,10 @@ build: mkdir -p c-out/obj c-out/obj/%.o: yait/%.c - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) -DCOMMIT=$(shell git rev-list --count --all) -c $< -o $@ $(YAIT): $(YAIT_OBJS) - $(CC) $(CFLAGS) $^ -o $@ + $(CC) $(CFLAGS) -DCOMMIT=$(shell git rev-list --count --all) $^ -o $@ endif diff --git a/config.h b/config.h index d88c949..8c7ddef 100644 --- a/config.h +++ b/config.h @@ -3,7 +3,6 @@ #define PROGRAM "yait" -#define ORGANIZATION "vx_clutch" #define VERSION "pre-alpha" #define YEAR 2025 diff --git a/core/standard.c b/core/standard.c index 48f708f..a991178 100644 --- a/core/standard.c +++ b/core/standard.c @@ -1,29 +1,18 @@ #include "standard.h" #include "../config.h" -#include "print.h" +#include #include #include -int -parse_standard_options (void (*usage) (), int argc, char **argv) -{ - for (int i = 1; i < argc; ++i) - { - if (strcmp (argv[i], "--help") == 0) - { - usage (); - exit (0); - } - else if (strcmp (argv[i], "--version") == 0) - { - printfn ("%s (%s) %s\nCopyright (C) %d %s.\n%s\n" - "This is free software: you are free to change " - "and redistribute it.\nThere is NO WARRANTY, to the extent " - "permitted by law.", - PROGRAM, ORGANIZATION, VERSION, YEAR, ORGANIZATION, - LICENCE_LINE); - exit (0); - } +int parse_standard_options(void (*usage)(), int argc, char **argv) { + for (int i = 1; i < argc; ++i) { + if (strcmp(argv[i], "--help") == 0) { + usage(); + exit(0); + } else if (strcmp(argv[i], "--version") == 0) { + printf("%s %s %d\n", PROGRAM, VERSION, COMMIT); + exit(0); } + } return -1; }