]> git.huck.website - odot.git/commitdiff
automatic backup
authorHuck Boles <huboles@protonmail.com>
Tue, 1 Nov 2022 03:00:01 +0000 (22:00 -0500)
committerHuck Boles <huboles@protonmail.com>
Tue, 1 Nov 2022 03:00:01 +0000 (22:00 -0500)
18 files changed:
.ccls-cache/@@home@huck@.repos@odot/@usr@include@bits@wordsize.h.blob
.ccls-cache/@@home@huck@.repos@odot/@usr@include@features-time64.h.blob
.ccls-cache/@@home@huck@.repos@odot/@usr@include@gnu@stubs.h.blob
.ccls-cache/@@home@huck@.repos@odot/@usr@include@stdc-predef.h.blob
.ccls-cache/@@home@huck@.repos@odot/@usr@include@stdio.h.blob
.ccls-cache/@home@huck@.repos@odot/dialogue.c.blob
.ccls-cache/@home@huck@.repos@odot/file.c
.ccls-cache/@home@huck@.repos@odot/file.c.blob
.ccls-cache/@home@huck@.repos@odot/func.c.blob
.ccls-cache/@home@huck@.repos@odot/input.c.blob
.ccls-cache/@home@huck@.repos@odot/main.c.blob
.ccls-cache/@home@huck@.repos@odot/odot.h
.ccls-cache/@home@huck@.repos@odot/odot.h.blob
.ccls-cache/@home@huck@.repos@odot/structure.c
.ccls-cache/@home@huck@.repos@odot/structure.c.blob
file.c
odot.h
structure.c

index 83d7c432e54ad466b9bc83ad31a6c6f26837ac7e..8bb53e8d03d484d6629c01395c89174588923faa 100644 (file)
Binary files a/.ccls-cache/@@home@huck@.repos@odot/@usr@include@bits@wordsize.h.blob and b/.ccls-cache/@@home@huck@.repos@odot/@usr@include@bits@wordsize.h.blob differ
index fa4aeeefde351230b3c827619850831b8fab8689..8bb2b3465a11dae93bf80fe88246ab3ee2d622e7 100644 (file)
Binary files a/.ccls-cache/@@home@huck@.repos@odot/@usr@include@features-time64.h.blob and b/.ccls-cache/@@home@huck@.repos@odot/@usr@include@features-time64.h.blob differ
index 234c447338a2159482b629834242ee78fc7399ac..dde057a9c04c2487e37f6fb2c2ba2d53f4c4f6b2 100644 (file)
Binary files a/.ccls-cache/@@home@huck@.repos@odot/@usr@include@gnu@stubs.h.blob and b/.ccls-cache/@@home@huck@.repos@odot/@usr@include@gnu@stubs.h.blob differ
index 605f6ab091b41d1545c257fd5f9a2f97db9d5dbc..4654a52653dcd41483d2fc86cc16619c9aa4aab4 100644 (file)
Binary files a/.ccls-cache/@@home@huck@.repos@odot/@usr@include@stdc-predef.h.blob and b/.ccls-cache/@@home@huck@.repos@odot/@usr@include@stdc-predef.h.blob differ
index 46791e7a1dd387ae708dabac96d02e756a46033b..cfe8c8ed7a8da9f95028bc605be30b733cd7e2b3 100644 (file)
Binary files a/.ccls-cache/@@home@huck@.repos@odot/@usr@include@stdio.h.blob and b/.ccls-cache/@@home@huck@.repos@odot/@usr@include@stdio.h.blob differ
index 47b96a61e7a5bd33321c2efc01050e5c3048afd8..a2f65019331cc2bce42652b881a2711193624f5f 100644 (file)
Binary files a/.ccls-cache/@home@huck@.repos@odot/dialogue.c.blob and b/.ccls-cache/@home@huck@.repos@odot/dialogue.c.blob differ
index 9449bae02d19c3f22245d0723ac2577b7106949a..ddf96f1c98dca7a67691755a7986a3ee1cedb4ce 100644 (file)
@@ -6,12 +6,13 @@ extern FILE *fp;
 
 enum color {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
 
+
 void add(void){
     fp = fopen(TODOLIST, "a");
-    if (fp == NULL)
-        error('f');
-    fputs(strcat(note,"\n"),fp);
-    fclose(fp);
+    if (fp != NULL){
+        fputs(strcat(note,"\n"),fp);
+        fclose(fp);
+    }
 }
 
 void rem(void){
@@ -19,8 +20,6 @@ void rem(void){
     FILE *tmp = fopen("temp", "w");
 
     fp = fopen(TODOLIST, "r");
-    if (fp == NULL)
-        error('f');
 
 
     while (fgets(s, MAXLINE, fp) != NULL){
@@ -40,14 +39,30 @@ void rem(void){
 }
 
 void show(void){
-    char *c = (char *) malloc(MAXLINE * sizeof(int));
+    char *c;
 
-    if (fp == NULL)
-        error('f');
+    c = (char *) malloc(MAXLINE * sizeof(int));
 
+    fp = fopen(TODOLIST,"r");
     while (fgets(c, MAXLINE, fp) != NULL )
-        printf("\t\t\033[1;3%im*\033[0m %s",geturgency(urgency), c);
+        printf("\t\t\033[1;35m*\033[0m %s", c);
     fclose(fp);
     free(c);
 }
 
+int listcheck(void){
+    char *s;
+
+    fp = fopen(TODOLIST, "r");
+    s = (char *) malloc(MAXLINE * sizeof(char));
+
+    while (fgets(s, MAXLINE, fp) != NULL){
+        s[strlen(s) - 1] = 0;
+        if (strcmp(note, s) == 0){
+            free(s);
+            return 1;
+        }
+    }
+    free(s);
+    return 0;
+}
index 2417fd5da138f7aec64cbb69479606626eb329e3..77dfd271ad9e7f1719619c6be98d6d505c7ece45 100644 (file)
Binary files a/.ccls-cache/@home@huck@.repos@odot/file.c.blob and b/.ccls-cache/@home@huck@.repos@odot/file.c.blob differ
index c06aab0bf66736f2f597baf7c2ea25135c6b5a44..d7698c7b994f30df81cdb5bc5ada896db94b44da 100644 (file)
Binary files a/.ccls-cache/@home@huck@.repos@odot/func.c.blob and b/.ccls-cache/@home@huck@.repos@odot/func.c.blob differ
index 36a66b37cd105299ef78c2657e5ac9148384f029..f93f99de33954d4cc5a86ceefb3c4289c133f751 100644 (file)
Binary files a/.ccls-cache/@home@huck@.repos@odot/input.c.blob and b/.ccls-cache/@home@huck@.repos@odot/input.c.blob differ
index 2c2f711729c86689f600924c8a2c27ae49f8eb91..1df34abc5830bc01cc47e31a47a4a095ff7c3382 100644 (file)
Binary files a/.ccls-cache/@home@huck@.repos@odot/main.c.blob and b/.ccls-cache/@home@huck@.repos@odot/main.c.blob differ
index 81a5ea96c54f5d966e36e08d75c6cd5480db575d..c465e23f26dba05a44952e917f217d7a03595195 100644 (file)
@@ -23,15 +23,15 @@ void add(void);
 void rem(void);
 void show(void);
 
-int listcheck(struct task);
+int listcheck(void);
 int geturgency(int);
 char *gettime(void);
 
 void error(char);
 
 struct task maketask(int n, char **arg);
-void puttask(struct task n, FILE *fp);
-struct task gettask(FILE *fp);
+void puttask(struct task n);
+struct task gettask(void);
 
 char *note, *o;
 int urgency;
index e61d6f5a9eda9f9d45ccaf5ee0d3e515d8358d04..4fa2ad9dbc59c2db9cf83154730769908a7536d7 100644 (file)
Binary files a/.ccls-cache/@home@huck@.repos@odot/odot.h.blob and b/.ccls-cache/@home@huck@.repos@odot/odot.h.blob differ
index ecdfb7f1cd1331b25b93c5083909039e94b25532..3f75b1003f92aca4a6a37a5097c2f4048f89d39a 100644 (file)
@@ -16,13 +16,11 @@ struct task maketask(int n, char **arg){
     return temp;
 }
 
-void puttask(struct task n, FILE *fp){
-
+void puttask(struct task n){
     fprintf(fp, "%i\t%s\t%s\t%s\t%i\n",n.length,n.task,n.date,n.due,n.urgency);
-    
 }
 
-struct task gettask(FILE *fp){
+struct task gettask(void){
     struct task tmp;
     
     fscanf(fp,"%i\t%s\t%s\t%s\t%i\n",&tmp.length,tmp.task,tmp.date,tmp.due,&tmp.urgency);
index c697e642af4be7b917743e35bbb7edce88afc1f0..d15481269b3f266ab5235d93b5f9305f100e2cf5 100644 (file)
Binary files a/.ccls-cache/@home@huck@.repos@odot/structure.c.blob and b/.ccls-cache/@home@huck@.repos@odot/structure.c.blob differ
diff --git a/file.c b/file.c
index 9449bae02d19c3f22245d0723ac2577b7106949a..ddf96f1c98dca7a67691755a7986a3ee1cedb4ce 100644 (file)
--- a/file.c
+++ b/file.c
@@ -6,12 +6,13 @@ extern FILE *fp;
 
 enum color {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
 
+
 void add(void){
     fp = fopen(TODOLIST, "a");
-    if (fp == NULL)
-        error('f');
-    fputs(strcat(note,"\n"),fp);
-    fclose(fp);
+    if (fp != NULL){
+        fputs(strcat(note,"\n"),fp);
+        fclose(fp);
+    }
 }
 
 void rem(void){
@@ -19,8 +20,6 @@ void rem(void){
     FILE *tmp = fopen("temp", "w");
 
     fp = fopen(TODOLIST, "r");
-    if (fp == NULL)
-        error('f');
 
 
     while (fgets(s, MAXLINE, fp) != NULL){
@@ -40,14 +39,30 @@ void rem(void){
 }
 
 void show(void){
-    char *c = (char *) malloc(MAXLINE * sizeof(int));
+    char *c;
 
-    if (fp == NULL)
-        error('f');
+    c = (char *) malloc(MAXLINE * sizeof(int));
 
+    fp = fopen(TODOLIST,"r");
     while (fgets(c, MAXLINE, fp) != NULL )
-        printf("\t\t\033[1;3%im*\033[0m %s",geturgency(urgency), c);
+        printf("\t\t\033[1;35m*\033[0m %s", c);
     fclose(fp);
     free(c);
 }
 
+int listcheck(void){
+    char *s;
+
+    fp = fopen(TODOLIST, "r");
+    s = (char *) malloc(MAXLINE * sizeof(char));
+
+    while (fgets(s, MAXLINE, fp) != NULL){
+        s[strlen(s) - 1] = 0;
+        if (strcmp(note, s) == 0){
+            free(s);
+            return 1;
+        }
+    }
+    free(s);
+    return 0;
+}
diff --git a/odot.h b/odot.h
index 81a5ea96c54f5d966e36e08d75c6cd5480db575d..c465e23f26dba05a44952e917f217d7a03595195 100644 (file)
--- a/odot.h
+++ b/odot.h
@@ -23,15 +23,15 @@ void add(void);
 void rem(void);
 void show(void);
 
-int listcheck(struct task);
+int listcheck(void);
 int geturgency(int);
 char *gettime(void);
 
 void error(char);
 
 struct task maketask(int n, char **arg);
-void puttask(struct task n, FILE *fp);
-struct task gettask(FILE *fp);
+void puttask(struct task n);
+struct task gettask(void);
 
 char *note, *o;
 int urgency;
index ecdfb7f1cd1331b25b93c5083909039e94b25532..3f75b1003f92aca4a6a37a5097c2f4048f89d39a 100644 (file)
@@ -16,13 +16,11 @@ struct task maketask(int n, char **arg){
     return temp;
 }
 
-void puttask(struct task n, FILE *fp){
-
+void puttask(struct task n){
     fprintf(fp, "%i\t%s\t%s\t%s\t%i\n",n.length,n.task,n.date,n.due,n.urgency);
-    
 }
 
-struct task gettask(FILE *fp){
+struct task gettask(void){
     struct task tmp;
     
     fscanf(fp,"%i\t%s\t%s\t%s\t%i\n",&tmp.length,tmp.task,tmp.date,tmp.due,&tmp.urgency);