aboutsummaryrefslogtreecommitdiff
path: root/fbwarn/src/extString.c
diff options
context:
space:
mode:
authoraxtloss <axtlos@getcryst.al>2024-02-25 20:24:05 +0100
committeraxtloss <axtlos@getcryst.al>2024-02-25 20:24:05 +0100
commit995fac7e0ce325ada75a6f921926b1f923e28dd0 (patch)
treecb748baeddfe34723cd7d2eefaee0ff99cf8a206 /fbwarn/src/extString.c
parent997368fe5f7ae8651982d0ba509bb54051b54e34 (diff)
downloadfsverify-995fac7e0ce325ada75a6f921926b1f923e28dd0.tar.gz
fsverify-995fac7e0ce325ada75a6f921926b1f923e28dd0.tar.bz2
add move bvg functions
Diffstat (limited to 'fbwarn/src/extString.c')
-rw-r--r--fbwarn/src/extString.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fbwarn/src/extString.c b/fbwarn/src/extString.c
index c93cffd..abe6728 100644
--- a/fbwarn/src/extString.c
+++ b/fbwarn/src/extString.c
@@ -13,3 +13,22 @@ char *strlwr(char *str)
return str;
}
+
+char *trim(char *str)
+{
+ char *result = strdup(str);
+ char *end;
+
+ while(isspace((unsigned char)*result)) result++;
+
+ if(*result == 0)
+ return result;
+
+ end = result + strlen(result) - 1;
+ while(end > result && isspace((unsigned char)*end)) end--;
+
+ // Write new null terminator character
+ end[1] = '\0';
+
+ return result;
+}