From a5e1191ad6c34636eb49c0ddaeb9af1bd5c07a2d Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Fri, 25 Sep 2026 20:31:22 -0500 Subject: made header file and made function names more sensible --- iceys-utils.c | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) (limited to 'iceys-utils.c') 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 #include #include #include +#include -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(®ex, "^[0-9]*$", 0); - if (reti) { - fprintf(stderr, "Could not compile regex\n"); - exit(1); - } - - - reti = regexec(®ex, number, 0, NULL, 0); - if (reti == REG_NOMATCH) { - return -2; - } - - regfree(®ex); - - 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 -- cgit v1.3