fix a ton of issues

This commit is contained in:
Liam Waldron 2023-04-14 11:54:44 -04:00
parent 73cf167096
commit effb433765
3 changed files with 16 additions and 9 deletions

View File

@ -2,9 +2,18 @@
#include <stdlib.h>
#include <unistd.h>
#include "../include/libcolor.h"
#include "nc.h"
int main(int argc, char *argv[]) {
if (argc < 2) {
printf("not enough options\n");
printf("usage: %c -l -n DATE EVENT_NAME\n", argv[0]);
return 1;
}
int opt;
while ((opt = getopt(argc, argv, ":if:nl")) != -1) {

View File

@ -16,16 +16,14 @@ char mkevent(int argc, char *argv[]) {
exit(1);
}
if (argc < 2) {
if (argc < 3) {
printf(TXT_BOLD COL_RED "not enough arguments\n" COL_RESET TXT_RESET);
return 1
}
printf("creating event on date %s", argv[2]);
printf("with name %s", argv[3]);
fprintf(fp, "BEGIN ENTRY\n");
fprintf(fp, "%s", argv[2]); /* print date */
fprintf(fp, "%s", argv[3]); /* print name */
fprintf(fp, "END ENTRY\n");
printf("creating event on date %s\n", argv[2]);
printf("with name %s\n", argv[3]);
fprintf(fp, "%s\n", argv[2]); /* print date */
fprintf(fp, "%s\n", argv[3]); /* print name */
fclose(fp);
}

View File

@ -20,11 +20,11 @@ char printevents() {
}
time_t t = time(NULL);
printf("[:=] To do for %s", ctime(&t));
printf(TXT_BOLD COL_BLUE "[:=] To do for %s", ctime(&t) COL_RESET TXT_RESET);
contents = fgetc(fp);
while (contents != EOF) {
printf ("%c", contents);
printf ("%c\n", contents);
contents = fgetc(fp);
}