aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorneonloop2021-08-21 00:10:44 +0000
committerneonloop2021-08-21 00:10:44 +0000
commit41fff233f29b6ee7274f4bf525052dcf0fa56c00 (patch)
treecfcc8fc9ae57b694d353cba8752a1f8fd99dc78e /util.h
parentf89bcd0179f4e07fe403894053c624d4983090c3 (diff)
downloadpicoarch-41fff233f29b6ee7274f4bf525052dcf0fa56c00.tar.gz
picoarch-41fff233f29b6ee7274f4bf525052dcf0fa56c00.tar.bz2
picoarch-41fff233f29b6ee7274f4bf525052dcf0fa56c00.zip
Updates message display and adds loading message to pcsx
Diffstat (limited to 'util.h')
-rw-r--r--util.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..641165b
--- /dev/null
+++ b/util.h
@@ -0,0 +1,21 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <stdbool.h>
+#include <string.h>
+
+#define MAX(a, b) (a) > (b) ? (a) : (b)
+#define MIN(a, b) (a) < (b) ? (a) : (b)
+
+#define array_size(x) (sizeof(x) / sizeof(x[0]))
+
+static inline bool has_suffix_i(const char *str, const char *suffix) {
+ const char *p = strrchr(str, suffix[0]);
+ if (!p) p = str;
+ return !strcasecmp(p, suffix);
+}
+
+void string_truncate(char *string, size_t max_len);
+void string_wrap(char *string, size_t max_len, size_t max_lines);
+
+#endif