140 lines
2.7 KiB
C
140 lines
2.7 KiB
C
/* proj.c
|
|
*
|
|
* The routines in this file generater an
|
|
* opinionated C project.
|
|
*
|
|
* written by vx-clutch
|
|
*/
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "estruct.h"
|
|
#include "file.h"
|
|
#include "input.h"
|
|
#include "proj.h"
|
|
#include "usage.h"
|
|
#include "util.h"
|
|
#include "version.h"
|
|
|
|
int makeproj(char *src) {
|
|
if (ffexist(src))
|
|
die("%s already exists", src);
|
|
|
|
fmkdir(src);
|
|
if (chdir(src))
|
|
die("could not cd into %s", src);
|
|
|
|
int year = getyear();
|
|
char *author = getstring("Author");
|
|
char *description = getstring("Description");
|
|
|
|
ffwrite("main.c", "\
|
|
/*\n\
|
|
* main.c\n\
|
|
*\n\
|
|
* %s/%s 1.0\n\
|
|
*\n\
|
|
* Copying policy\n\
|
|
*\n\
|
|
* %s 1.0 can be copied and distributed freely for any\n\
|
|
* non-commercial purposes. %s 1.0 can only be incorporated\n\
|
|
* into commercial software with the permission of the current author.\n\
|
|
*\n\
|
|
* This file contains the main driving routine.\n\
|
|
*\n\
|
|
*/\n\
|
|
\n\
|
|
#include <stdio.h>\n\
|
|
#include <stdlib.h>\n\
|
|
#include <string.h>\n\
|
|
\n\
|
|
void usage(int status)\n\
|
|
{\n\
|
|
printf(\"Usage: %%s REQUIRED POSITIONAL ARGUMENT\\n\", PROGRAM_NAME);\n\
|
|
printf(\" or: %%s [options]\\n\\n\", PROGRAM_NAME);\n\
|
|
fputs(\" --help display this help and exit\\n\", stdout);\n\
|
|
fputs(\" --version output version information and exit\\n\", stdout);\n\
|
|
\n\
|
|
exit(status);\n\
|
|
}\n\
|
|
\n\
|
|
int main(int argc, char **argv)\n\
|
|
{\n\
|
|
int carg;\n\
|
|
\n\
|
|
if (argc == 2) {\n\
|
|
if (strcmp(argv[1], \"--help\") == 0) {\n\
|
|
usage(EXIT_FAILURE);\n\
|
|
}\n\
|
|
if (strcmp(argv[1], \"--version\") == 0) {\n\
|
|
version();\n\
|
|
exit(EXIT_SUCCESS);\n\
|
|
}\n\
|
|
}\n\
|
|
\n\
|
|
return 0;\n\
|
|
}", src, author, src, src);
|
|
|
|
ffwrite("README", "\
|
|
+--------------------+\n\
|
|
| %s/%s 1.0 |\n\
|
|
+--------------------+\n\
|
|
\n\
|
|
%s\n\
|
|
\n\
|
|
%s was written by %s\n\
|
|
\n\
|
|
Copyright Notices:\n\
|
|
\n\
|
|
%s 1.0 (c) Copyright %d %s\n\
|
|
\n\
|
|
Reference the COPYING file for detailed information\n\
|
|
\n\
|
|
\n\
|
|
WHAT IS %s/%s?\n\
|
|
\n\
|
|
%s/%s 1.0 %s\n\
|
|
\n\
|
|
\n\
|
|
WHAT IS NEW\n\
|
|
\n\
|
|
Features:\n\
|
|
\n\
|
|
o This is the first version, EVERYTHING is new!\n\
|
|
\n\
|
|
Bug fixes - not very interesting:\n\
|
|
\n\
|
|
o None\n\
|
|
\n\
|
|
Something is gone:\n\
|
|
\n\
|
|
o None\n\
|
|
\n\
|
|
HOW TO INSTALL %s/%s?\n\
|
|
\n\
|
|
o UNIX: Look at estruct.h, do a 'make', test the program, 'make install'.\n\
|
|
\n\
|
|
\n\
|
|
ACKNOWLEDGEMENTS AND STATUS\n\
|
|
\n\
|
|
This project's file strucutre, file format, and certain contents are\n\
|
|
derived from uEmacs/PK 4.0 specifically from the Linux Torvalds\n\
|
|
distribution on GitHub. The README on from uEmacs/PK 4.0 has greater and\n\
|
|
more accurate attributions, if you desire.\n\
|
|
\n\
|
|
%s was generated using yait/fSD %s.\n\
|
|
\n\
|
|
LAST MODIFED DATE\
|
|
",
|
|
src, author,
|
|
description,
|
|
src, author,
|
|
src, year, author,
|
|
src, author,
|
|
src, author, description,
|
|
src, author,
|
|
src, VERSION);
|
|
|
|
return 0;
|
|
}
|