]> Pileus Git - lackey/blobdiff - src/util.c
Add ical todos
[lackey] / src / util.c
index f13ad443c5f560418e5a30f4e27d4ad09abcebea..929ec04f5aa7456d11bd77139fc7afe7d51d1019 100644 (file)
@@ -21,7 +21,9 @@
 #include <string.h>
 #include <ncurses.h>
 
-#include "screen.h"
+#include "date.h"
+#include "cal.h"
+#include "view.h"
 
 /* Static data */
 static FILE *debug_fd = NULL;
@@ -32,15 +34,12 @@ void util_init(void)
        debug_fd = fopen("/tmp/lackey.log", "w+");
 }
 
-/* Misc functions */
-char *sdup(const char *str)
+/* String functions */
+void strsub(char *str, char find, char repl)
 {
-       if (str == NULL)
-               return NULL;
-       int len = strlen(str);
-       char *dup = malloc(len+1);
-       memcpy(dup, str, len+1);
-       return dup;
+       for (char *cur = str; *cur; cur++)
+               if (*cur == find)
+                       *cur = repl;
 }
 
 /* Debugging functions */