75 lines
1.5 KiB
C
75 lines
1.5 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"
|
|
|
|
int makeproj(char *src)
|
|
{
|
|
if (ffexist(src))
|
|
die("%s already exists", src);
|
|
|
|
fmkdir(src);
|
|
if (chdir(src))
|
|
die("could not cd into %s", src);
|
|
|
|
ffwrite("main.c", "\
|
|
/*\n\
|
|
* main.c\n\
|
|
*\n\
|
|
* package/Author 1.0\n\
|
|
*\n\
|
|
* Copying policy\n\
|
|
*\n\
|
|
* yait 1.0 can be copied and distributed freely for any\n\
|
|
* non-commercial purposes. yait 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\
|
|
}");
|
|
|
|
return 0;
|
|
}
|