This commit is contained in:
2023-04-01 23:13:39 -04:00
commit 416ef34ffd
7 changed files with 212 additions and 0 deletions

6
src/config.h Normal file
View 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
View 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
View 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
View 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);
}