init
This commit is contained in:
6
src/config.h
Normal file
6
src/config.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef CONFIG_H_
|
||||
#define CONFIG_H_
|
||||
|
||||
#define NC_EVENTS_FILE "/etc/nc/events"
|
||||
|
||||
#endif
|
||||
17
src/main.c
Normal file
17
src/main.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/argparse.h"
|
||||
|
||||
static const char *const usages[] = {
|
||||
"nc -c -r DATE EVENT_NAME",
|
||||
NULL,
|
||||
};
|
||||
|
||||
#define PERM_READ (1<<0)
|
||||
#define PERM_WRITE (1<<1)
|
||||
#define PERM_EXEC (1<<2)
|
||||
|
||||
int main (int argc, const char **argv) {
|
||||
int
|
||||
7
src/mkevent.c
Normal file
7
src/mkevent.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../include/libcolor.h"
|
||||
|
||||
#include "config.h"
|
||||
29
src/printevents.c
Normal file
29
src/printevents.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../include/libcolor.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
char printevents() {
|
||||
FILE *fp;
|
||||
|
||||
char filename[100], contents;
|
||||
|
||||
fp = fopen(NC_EVENTS_FILE, "r");
|
||||
if (fp == NULL) {
|
||||
printf(TXT_BOLD COL_RED "events file does not exist\n");
|
||||
printf("ensure the events file defined in config.h exists\n" COL_RESET TXT_RESET);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
contents = fgetc(fp);
|
||||
while (contents != EOF) {
|
||||
printf ("%c", contents);
|
||||
contents = fgetc(fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
exit(0);
|
||||
}
|
||||
Reference in New Issue
Block a user