aboutsummaryrefslogtreecommitdiff
path: root/iceys-utils.c
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-09-25 20:31:22 -0500
committericeyrazor <iceyrazor@mailfence.com>2026-09-25 20:31:22 -0500
commita5e1191ad6c34636eb49c0ddaeb9af1bd5c07a2d (patch)
tree58c5dea3afcdc8b665004d3f4ebc6df222cf524b /iceys-utils.c
parenteffc9a1a4f4c6108ba14fe457ba1add547e86244 (diff)
made header file and made function names more sensibleHEADmain
Diffstat (limited to 'iceys-utils.c')
-rwxr-xr-xiceys-utils.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/iceys-utils.c b/iceys-utils.c
index 2331322..be56eef 100755
--- a/iceys-utils.c
+++ b/iceys-utils.c
@@ -1,11 +1,14 @@
-#ifndef iceys_utils_c
-#define iceys_utils_c
#include <string.h>
#include <stdlib.h>
#include <regex.h>
#include <stdio.h>
+#include <iceys-utils.h>
-char *strremove(char *str, const char *sub) {
+float map(float value, float start1, float stop1, float start2, float stop2){
+ return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
+}
+
+char *str_remove_all(char *str, const char *sub) {
size_t len = strlen(sub);
if (len > 0) {
char *p = str;
@@ -18,12 +21,7 @@ char *strremove(char *str, const char *sub) {
return str;
}
-float map(float value, float start1, float stop1, float start2, float stop2){
- return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
-}
-
-//i made this one :)
-void str_first(char *str, char *str2, char eraser, int found_count){
+void str_before_nth(char *str, char *str2, char eraser, int found_count){
int i=0;
int found=0;
@@ -39,32 +37,6 @@ void str_first(char *str, char *str2, char eraser, int found_count){
memcpy(str2,str,sizeof(char)*i);
}
-regex_t regex;
-int reti;
-
-int is_number(char *number){
- if(!number){
- return -1;
- }
-
- /* Compile regular expression */
- reti = regcomp(&regex, "^[0-9]*$", 0);
- if (reti) {
- fprintf(stderr, "Could not compile regex\n");
- exit(1);
- }
-
-
- reti = regexec(&regex, number, 0, NULL, 0);
- if (reti == REG_NOMATCH) {
- return -2;
- }
-
- regfree(&regex);
-
- return 1;
-}
-
int execret(char *return_buffer, char *command){
// Open a process by creating a pipe
FILE *fp = popen(command, "r");
@@ -116,4 +88,3 @@ int execretarr(char **return_arr, char *command){
return 0;
}
-#endif