fix a ton of issues
This commit is contained in:
parent
73cf167096
commit
effb433765
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user