mirror of
https://github.com/sheumann/hush.git
synced 2025-01-09 09:31:07 +00:00
Fix to trim to make it trim properly.
This commit is contained in:
parent
b180dd9e50
commit
afffbfe8c4
@ -1831,13 +1831,13 @@ void chomp(char *s)
|
|||||||
#if defined(BB_SH)
|
#if defined(BB_SH)
|
||||||
void trim(char *s)
|
void trim(char *s)
|
||||||
{
|
{
|
||||||
|
/* trim trailing whitespace */
|
||||||
|
while (isspace(s[strlen(s)-1]))
|
||||||
|
s[strlen(s)-1]='\0';
|
||||||
|
|
||||||
/* trim leading whitespace */
|
/* trim leading whitespace */
|
||||||
memmove(s, &s[strspn(s, " \n\r\t\v")], strlen(s));
|
memmove(s, &s[strspn(s, " \n\r\t\v")], strlen(s));
|
||||||
|
|
||||||
/* trim trailing whitespace */
|
|
||||||
while (*s && (!isspace (*s)))
|
|
||||||
s++;
|
|
||||||
*s='\0';
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user