mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-02 06:35:44 +01:00
Fixed wtrimspace() whih had wrong behavior.
This commit is contained in:
@@ -162,15 +162,15 @@ wtrimspace(char *s)
|
|||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
char *c;
|
char *c;
|
||||||
|
|
||||||
while (isspace(*s) && *s) s++;
|
while (isspace(*s) && *s) s++;
|
||||||
t = s+strlen(s);
|
t = s+strlen(s)-1;
|
||||||
while (t > s && isspace(*t)) t--;
|
while (t > s && isspace(*t)) t--;
|
||||||
|
|
||||||
c = wmalloc(t-s + 1);
|
c = wmalloc(t-s+2);
|
||||||
memcpy(c, s, t-s);
|
memcpy(c, s, t-s+1);
|
||||||
c[t-s] = 0;
|
c[t-s+1] = 0;
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user