Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 54db089b71 |
12
edef.h
12
edef.h
@@ -1,14 +1,18 @@
|
||||
/* edef.h
|
||||
*
|
||||
* Program definitions
|
||||
*
|
||||
* Global variable definition
|
||||
*
|
||||
* written by vx-clutch
|
||||
*/
|
||||
|
||||
#ifndef EDEF_H_
|
||||
#define EDEF_H_
|
||||
|
||||
enum { SINGLE = 1, FULL = 2 };
|
||||
/* Initialized global external declarations. */
|
||||
|
||||
#define NPAT 4096 /* number of bytes for path buffer */
|
||||
extern int git;
|
||||
|
||||
/* Other constants declarations */
|
||||
enum { SINGLE, FULL };
|
||||
|
||||
#endif /* EDEF_H_ */
|
||||
|
||||
@@ -9,4 +9,10 @@
|
||||
#define QAUTHOR 0 /* Force use the default author option */
|
||||
#define AUTHOR "fSD" /* Default author */
|
||||
|
||||
#define DEFAULT_GIT 0 /* Default git state */
|
||||
|
||||
/* Internal constants */
|
||||
|
||||
#define NPAT 128
|
||||
|
||||
#endif /* ESTRUCT_H_ */
|
||||
|
||||
5
file.c
5
file.c
@@ -1,8 +1,7 @@
|
||||
/* file.c
|
||||
*
|
||||
* The routines in this file handle the reading, writing
|
||||
* and lookup of disk files. All of details about the
|
||||
* reading and writing of the disk are in "fileio.c".
|
||||
* and lookup of disk files.
|
||||
*
|
||||
* written by vx-clutch
|
||||
*/
|
||||
@@ -17,7 +16,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "file.h"
|
||||
#include "edef.h"
|
||||
#include "estruct.h"
|
||||
|
||||
int ffwrite(char *path, char *fmt, ...) {
|
||||
FILE *f;
|
||||
|
||||
3
full.c
3
full.c
@@ -10,6 +10,7 @@
|
||||
#include "file.h"
|
||||
#include "full.h"
|
||||
#include "usage.h"
|
||||
#include "git.h"
|
||||
|
||||
int full_project_init_and_cd(char *src)
|
||||
{
|
||||
@@ -72,5 +73,7 @@ more accurate attributions, if you desire.\n\
|
||||
\n\
|
||||
LATE MODIFIED DATE", src, src);
|
||||
|
||||
ginit(); /* initialize a git repository */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
17
git.c
Normal file
17
git.c
Normal file
@@ -0,0 +1,17 @@
|
||||
/* git.c
|
||||
*
|
||||
* Routines for initilizing a git repository
|
||||
*
|
||||
* written by vx-clutch
|
||||
*/
|
||||
|
||||
#include "git.h"
|
||||
#include "edef.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
int ginit()
|
||||
{
|
||||
if (git) return 0;
|
||||
system("git init --quiet");
|
||||
return 0;
|
||||
}
|
||||
6
git.h
Normal file
6
git.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef GIT_H_
|
||||
#define GIT_H_
|
||||
|
||||
int ginit();
|
||||
|
||||
#endif /* GIT_H_ */
|
||||
6
globals.c
Normal file
6
globals.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "estruct.h"
|
||||
#include "edef.h"
|
||||
|
||||
/* initialized global definitions */
|
||||
|
||||
int git = DEFAULT_GIT;
|
||||
10
main.c
10
main.c
@@ -17,6 +17,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "edef.h"
|
||||
#include "proj.h"
|
||||
@@ -28,8 +32,8 @@ void usage(int status) {
|
||||
printf("Usage: %s filename\n", PROGRAM_NAME);
|
||||
printf(" or: %s [options]\n\n", PROGRAM_NAME);
|
||||
fputs(" -s enable shell creation mode\n", stdout);
|
||||
fputs(" -S enable shell creation mode as a full project\n",
|
||||
stdout);
|
||||
fputs(" -S enable shell creation mode as a full project\n", stdout);
|
||||
fputs(" --git initialize a git repository\n", stdout);
|
||||
fputs(" --help display this help and exit\n", stdout);
|
||||
fputs(" --version output version information and exit\n", stdout);
|
||||
|
||||
@@ -59,6 +63,8 @@ int main(int argc, char **argv) {
|
||||
shell_mode = SINGLE;
|
||||
else if (argv[carg][1] == 'S')
|
||||
shell_mode = FULL;
|
||||
else if (strcmp(argv[carg], "--git"))
|
||||
git = 1;
|
||||
else
|
||||
die("unknown option");
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user