nc/src/printevents.c

36 lines
643 B
C

#include <color.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.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(COL_RED "events file does not exist\n");
printf("ensure the events file defined in config.h exists\n" COL_RESET);
exit(1);
}
time_t t = time(NULL);
printf(COL_BLUE "[:=] To do for %s", ctime(&t));
printf(COL_RESET"\n");
contents = fgetc(fp);
while (contents != EOF) {
printf ("%c", contents);
contents = fgetc(fp);
}
fclose(fp);
exit(0);
}