aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ini.h2
-rw-r--r--include/str.h31
-rw-r--r--include/strlist.h8
-rw-r--r--include/system.h2
-rw-r--r--include/template.h2
-rw-r--r--include/utils.h2
6 files changed, 15 insertions, 32 deletions
diff --git a/include/ini.h b/include/ini.h
index fa2bd98..022a066 100644
--- a/include/ini.h
+++ b/include/ini.h
@@ -98,7 +98,7 @@ struct INIFILE *ini_open(const char *filename);
* @param value
* @return
*/
-struct INISection *ini_section_search(struct INIFILE **ini, unsigned mode, char *value);
+struct INISection *ini_section_search(struct INIFILE **ini, unsigned mode, const char *value);
/**
*
diff --git a/include/str.h b/include/str.h
index 8018cc0..595a055 100644
--- a/include/str.h
+++ b/include/str.h
@@ -29,7 +29,7 @@ int num_chars(const char *sptr, int ch);
*
* @param sptr string to scan
* @param pattern string to search for
- * @return 1 = found, 0 = not found, -1 = error
+ * @return 1 = found, 0 = not found / error
*/
int startswith(const char *sptr, const char *pattern);
@@ -38,7 +38,7 @@ int startswith(const char *sptr, const char *pattern);
*
* @param sptr string to scan
* @param pattern string to search for
- * @return 1 = found, 0 = not found, -1 = error
+ * @return 1 = found, 0 = not found / error
*/
int endswith(const char *sptr, const char *pattern);
@@ -51,33 +51,6 @@ int endswith(const char *sptr, const char *pattern);
void strchrdel(char *sptr, const char *chars);
/**
- * Find the integer offset of the first occurrence of `ch` in `sptr`
- *
- * ~~~{.c}
- * char buffer[255];
- * char string[] = "abc=123";
- * long int separator_offset = strchroff(string, '=');
- * for (long int i = 0; i < separator_offset); i++) {
- * buffer[i] = string[i];
- * }
- * ~~~
- *
- * @param sptr string to scan
- * @param ch character to find
- * @return offset to character in string, or 0 on failure
- */
-long int strchroff(const char *sptr, int ch);
-
-/**
- * This function scans `sptr` from right to left removing any matches to `suffix`
- * from the string.
- *
- * @param sptr string to be modified
- * @param suffix string to be removed from `sptr`
- */
-void strdelsuffix(char *sptr, const char *suffix);
-
-/**
* Split a string by every delimiter in `delim` string.
*
* Callee should free memory using `GENERIC_ARRAY_FREE()`
diff --git a/include/strlist.h b/include/strlist.h
index 2d3c3cf..3f35e23 100644
--- a/include/strlist.h
+++ b/include/strlist.h
@@ -44,4 +44,12 @@ struct StrList *strlist_copy(struct StrList *pStrList);
int strlist_cmp(struct StrList *a, struct StrList *b);
void strlist_free(struct StrList **pStrList);
+#define STRLIST_E_SUCCESS 0
+#define STRLIST_E_OUT_OF_RANGE 1
+#define STRLIST_E_INVALID_VALUE 2
+#define STRLIST_E_UNKNOWN 3
+extern int strlist_errno;
+const char *strlist_get_error(int flag);
+
+
#endif //OMC_STRLIST_H
diff --git a/include/system.h b/include/system.h
index 7428355..94d5a36 100644
--- a/include/system.h
+++ b/include/system.h
@@ -14,6 +14,8 @@
#include <sys/wait.h>
#include <sys/stat.h>
+#define OMC_SHELL_SAFE_RESTRICT ";&|()"
+
struct Process {
// Write stdout stream to file
char f_stdout[PATH_MAX];
diff --git a/include/template.h b/include/template.h
index a242a08..362eb3d 100644
--- a/include/template.h
+++ b/include/template.h
@@ -42,7 +42,7 @@ int tpl_render_to_file(char *str, const char *filename);
struct tplfunc_frame *tpl_getfunc(char *key);
struct tplfunc_frame;
-typedef int tplfunc(struct tplfunc_frame *frame);
+typedef int tplfunc(struct tplfunc_frame *frame, void *result);
struct tplfunc_frame {
char *key;
tplfunc *func;
diff --git a/include/utils.h b/include/utils.h
index a340cd7..8840a0d 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -329,7 +329,7 @@ char *collapse_whitespace(char **s);
* @param maxlen maximum length of dest byte array
* @return 0 on success, -1 on error
*/
-int redact_sensitive(const char **to_redact, char *src, char *dest, size_t maxlen);
+int redact_sensitive(const char **to_redact, size_t to_redact_size, char *src, char *dest, size_t maxlen);
/**
* Given a directory path, return a list of files