wip
This commit is contained in:
@@ -7,6 +7,6 @@
|
|||||||
#define LICENSE "BSD-3-Clause" /* Default SPDX-License-Identifier */
|
#define LICENSE "BSD-3-Clause" /* Default SPDX-License-Identifier */
|
||||||
|
|
||||||
#define QAUTHOR 0 /* Force use the default author option */
|
#define QAUTHOR 0 /* Force use the default author option */
|
||||||
#define AUTHOR "fSD" /* Default author*/
|
#define AUTHOR "fSD" /* Default author */
|
||||||
|
|
||||||
#endif /* ESTRUCT_H_ */
|
#endif /* ESTRUCT_H_ */
|
||||||
|
|||||||
44
proj.c
44
proj.c
@@ -52,6 +52,7 @@ int makeproj(char *src) {
|
|||||||
#include <string.h>\n\
|
#include <string.h>\n\
|
||||||
\n\
|
\n\
|
||||||
#include \"version.h\"\n\
|
#include \"version.h\"\n\
|
||||||
|
#include \"estruct.h\"\n\
|
||||||
\n\
|
\n\
|
||||||
void usage(int status)\n\
|
void usage(int status)\n\
|
||||||
{\n\
|
{\n\
|
||||||
@@ -77,7 +78,7 @@ int main(int argc, char **argv)\n\
|
|||||||
}\n\
|
}\n\
|
||||||
}\n\
|
}\n\
|
||||||
\n\
|
\n\
|
||||||
puts(\"Hello, World!\");\n\
|
puts(MESSAGE);\n\
|
||||||
\n\
|
\n\
|
||||||
return 0;\n\
|
return 0;\n\
|
||||||
}", src, author, src, src);
|
}", src, author, src, src);
|
||||||
@@ -218,5 +219,46 @@ release: $(PROGRAM)\n\
|
|||||||
$(E) \" CC \" $@\n\
|
$(E) \" CC \" $@\n\
|
||||||
$(Q) $(CC) $(CFLAGS) $(DEFINES) -c $< -o $@", src, src);
|
$(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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user