summaryrefslogtreecommitdiff
path: root/src/calcurse.h
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-11 19:32:14 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-13 17:39:44 +0100
commit03d35bacf44d7f3e63805411370b7ada8aae93e8 (patch)
tree75c3b1b5e3f20d060e35156f50a2638879871c12 /src/calcurse.h
parent0b7614a4a7a88167066ee28553d278ac4bb66714 (diff)
downloadcalcurse-03d35bacf44d7f3e63805411370b7ada8aae93e8.zip
Implement utility functions for dynamic strings
Introduce support for strings which support concatenating the current value with a printf-style formatted value, thereby growing in size dynamically. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/calcurse.h')
-rw-r--r--src/calcurse.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/calcurse.h b/src/calcurse.h
index 1ab5363..aeeec4c 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -601,6 +601,13 @@ struct nbar {
pthread_mutex_t mutex;
};
+/* Dynamic strings. */
+struct string {
+ char *buf;
+ int bufsize;
+ int len;
+};
+
/* Return codes for the getstring() function. */
enum getstr {
GETSTRING_VALID,
@@ -982,6 +989,15 @@ unsigned sigs_set_hdlr(int, void (*)(int));
void sigs_ignore(void);
void sigs_unignore(void);
+/* strings.c */
+void string_init(struct string *);
+void string_reset(struct string *);
+int string_grow(struct string *, int);
+char *string_buf(struct string *);
+int string_catf(struct string *, const char *, ...);
+int string_vcatf(struct string *, const char *, va_list);
+int string_printf(struct string *, const char *, ...);
+
/* todo.c */
extern llist_t todolist;
struct todo *todo_get_item(int);