This commit is contained in:
2025-11-13 21:34:44 -05:00
parent 52c0d05889
commit 82635759a7
2 changed files with 44 additions and 2 deletions

View File

@@ -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_ */

44
proj.c
View File

@@ -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;
}