]> git.huck.website - odot.git/commitdiff
bug fixes
authorHuck Boles <huboles@protonmail.com>
Sat, 26 Nov 2022 20:48:54 +0000 (14:48 -0600)
committerHuck Boles <huboles@protonmail.com>
Sat, 26 Nov 2022 20:48:54 +0000 (14:48 -0600)
Makefile
README.md
main.c

index 170821824b045268ee6b23a96db1a4ae20894889..8717a93d2a67f2a7b216e16c5b81d99131351b6f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,13 @@
 SHELL = /bin/bash
 PROG = odot
-PREFIX ?= /usr
-BINDIR ?= $(PREFIX)/bin
-SHAREDIR ?= $(HOME)/.local/share
+BINDIR ?= /bin
+STATEDIR ?= $(HOME)/.local/state
 
 
 install : main.c
        sudo gcc main.c -o '$(BINDIR)/$(PROG)'
-       [[ ! -d '$(SHAREDIR)/$(PROG))' ]] && mkdir -p '$(SHAREDIR)/$(PROG)'
+       [[ ! -d '$(STATEDIR)/$(PROG))' ]] && mkdir -p '$(STATEDIR)/$(PROG)'
 
 clean : 
-       rm -rf '$(SHAREDIR)/$(PROG)'
+       rm -rf '$(STATEDIR)/$(PROG)'
 
index 7ea75c79b6c2c106b52b668ebb534a5ba416fc83..eb946a106e422ae636a2b2f9a3090243b9587935 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,23 +1,30 @@
 # odot
 Todo manager written in C
 
-Usage:
+Extremely basic to use, simply call ***odot*** with a task to add or
+remove it from the list, or call ***odot*** all by iteself to see the
+current todo list in alphabetical order.
 
-  Add new task to list:
+* Usage:
+
+    - Add new task to list:
  
-    $ odot [new task not on list]  
+            $ odot [new task not on list]  
+    
+    - Remove task from list:
     
- Remove task from list:
-  
-    $ odot [task already on list] 
+            $ odot [task already on list] 
    
- Show list:
   - Show list:
  
-    $ odot 
+            $ odot 
     
-Installation:
+* Installation:
+
+        $ git clone https://github.com/huboles/odot.git
+        $ cd odot
+        $ make install
+
+***odot*** stores current and completed tasks in plaintext .txt files, located at
+$HOME/.local/share/odot.
 
-    $ git clone https://github.com/huboles/odot.git
-    $ cd odot
-    $ sudo gcc *.c -o /usr/bin/odot
-    $ mkdir $HOME/.local/state/odot
diff --git a/main.c b/main.c
index 6c36855ee7c45b0a11650bba72a9839500e1352c..a2285f5d9c54dd6ee7fb9062296ca23d56e5dcfe 100644 (file)
--- a/main.c
+++ b/main.c
@@ -21,15 +21,24 @@ int main(int argc, char *argv[]){
     extern char *tmp;
 
     char *homedir = getenv("HOME");
-    list = strcat(homedir,"/.local/share/odot/todo.txt");
-    done = strcat(homedir,"/.local/share/odot/done.txt");
-    tmp = strcat(homedir,"/.local/share/odot/tmp.txt");
+
+    list = malloc((strlen(homedir)+22)*sizeof(char));
+    done = malloc((strlen(homedir)+22)*sizeof(char));
+    tmp = malloc((strlen(homedir)+21)*sizeof(char));
+
+    sprintf(list,"%s/.local/state/odot/todo.txt",homedir);
+    sprintf(done,"%s/.local/state/odot/done.txt",homedir);
+    sprintf(tmp,"%s/.local/state/odot/tmp.txt",homedir);
 
     if (argc == 1){
         show();
     } else {
         addnote(getnote(argc,argv));
     }
+
+    free(tmp);
+    free(done);
+    free(list);
     return 0;
 }