summaryrefslogtreecommitdiff
path: root/include/ouroboros/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ouroboros/utils.h')
-rw-r--r--include/ouroboros/utils.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h
index 426a143c..93fbf402 100644
--- a/include/ouroboros/utils.h
+++ b/include/ouroboros/utils.h
@@ -1,5 +1,5 @@
/*
- * Ouroboros - Copyright (C) 2016 - 2021
+ * Ouroboros - Copyright (C) 2016 - 2024
*
* Handy utilities
*
@@ -20,15 +20,18 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
-#ifndef OUROBOROS_UTILS_H
-#define OUROBOROS_UTILS_H
+#ifndef OUROBOROS_LIB_UTILS_H
+#define OUROBOROS_LIB_UTILS_H
#include <stdint.h>
#include <unistd.h>
+#include <string.h>
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define ABS(a) ((a) > 0 ? (a) : -(a))
+#define clrbuf(buf) do { memset(&(buf), 0, sizeof(buf)); } while (0);
+#define freebuf(buf) do { free((buf).data); clrbuf(buf); } while (0);
typedef struct {
uint8_t * data;
@@ -42,7 +45,14 @@ typedef struct {
int n_digits(unsigned i);
/* gets the application name */
-char * path_strip(char * src);
+char * path_strip(const char * src);
+
+/* functions for copying and destroying arguments list */
+size_t argvlen(const char ** argv);
+
+char ** argvdup(char ** argv);
+
+void argvfree(char ** argv);
/* destroy a ** */
#define freepp(type, ptr, len) \
@@ -54,4 +64,4 @@ char * path_strip(char * src);
free(ptr); \
} while (0);
-#endif /* OUROBOROS_UTILS_H */
+#endif /* OUROBOROS_LIB_UTILS_H */