commit 82635759a7908ba1f6db158514171afc107fbf21
parent 52c0d0588954aeebef5d9aba80ea51226dcfc240
Author: vx-clutch <[email protected]>
Date: Thu, 13 Nov 2025 21:34:44 -0500
wip
Diffstat:
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/estruct.h b/estruct.h
@@ -7,6 +7,6 @@
#define LICENSE "BSD-3-Clause" /* Default SPDX-License-Identifier */
#define QAUTHOR 0 /* Force use the default author option */
-#define AUTHOR "fSD" /* Default author*/
+#define AUTHOR "fSD" /* Default author */
#endif /* ESTRUCT_H_ */
diff --git a/proj.c b/proj.c
@@ -52,6 +52,7 @@ int makeproj(char *src) {
#include <string.h>\n\
\n\
#include \"version.h\"\n\
+#include \"estruct.h\"\n\
\n\
void usage(int status)\n\
{\n\
@@ -77,7 +78,7 @@ int main(int argc, char **argv)\n\
}\n\
}\n\
\n\
- puts(\"Hello, World!\");\n\
+ puts(MESSAGE);\n\
\n\
return 0;\n\
}", src, author, src, src);
@@ -218,5 +219,46 @@ release: $(PROGRAM)\n\
$(E) \" CC \" $@\n\
$(Q) $(CC) $(CFLAGS) $(DEFINES) -c $< -o $@", src, src);
+ ffwrite("usage.h", "\
+#ifndef USAGE_H_\n\
+#define USAGE_H_\n\
+\n\
+void die(const char* err, ...);\n\
+\n\
+#endif /* USAGE_H_ */");
+ ffwrite("usage.c", "\
+#include \"usage.h\"\n\
+\n\
+#include <stdarg.h>\n\
+#include <stdio.h>\n\
+#include <stdlib.h>\n\
+\n\
+static void report(const char* prefix, const char *err, va_list params)\n\
+{\n\
+ char msg[4096];\n\
+ vsnprintf(msg, sizeof(msg), err, params);\n\
+ fprintf(stderr, \"%%s%%s\\n\", prefix, msg);\n\
+}\n\
+\n\
+void die(const char* err, ...)\n\
+{\n\
+ va_list params;\n\
+\n\
+ va_start(params, err);\n\
+ report(\"fatal: \", err, params);\n\
+ va_end(params);\n\
+ exit(128);\n\
+}");
+
+ ffwrite("estruct.h", "\
+#ifndef ESTRUCT_H_\n\
+#define ESTRUCT_H_\n\
+\n\
+/* Configuration options */\n\
+\n\
+#define MESSAGE \"Hello, World!\" /* Default greeting */\n\
+\n\
+#endif /* ESTRUCT_H_ */");
+
return 0;
}