commit 9b4b0852994cf03fc28d789a109719ddaa515e7b
parent e1e2f6d88444fb1a71fefe4ee5c2e122657b9731
Author: sam-barr <samfbarr@outlook.com>
Date: Mon, 27 Apr 2020 09:58:37 -0500
Trim leading whitespace from CPU and GPU
Fixes Issue #48
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/paleofetch.c b/paleofetch.c
@@ -53,9 +53,11 @@ void remove_newline(char *s) {
/*
* Cleans up repeated spaces in a string
+ * Trim spaces at the front of a string
*/
void truncate_spaces(char *str) {
int src = 0, dst = 0;
+ while(*(str + dst) == ' ') dst++;
while(*(str + dst) != '\0') {
*(str + src) = *(str + dst);
@@ -65,7 +67,7 @@ void truncate_spaces(char *str) {
src++;
}
- *(str +src) = '\0';
+ *(str + src) = '\0';
}
/*