[BusyBox] PATCH for crond EOL bug (Was: the bug system and 1.0.1)

Vladimir N. Oleynik dzo at simtreas.ru
Mon Jul 18 16:35:32 UTC 2005


I wrote:

> May be

Have problem if arg have whitespace only.

> void trim(char *s)
> {
>         size_t len = strlen(s);
>         size_t lws;
> 
>         /* trim trailing whitespace */
>         while ( len > 0 && isspace(s[len-1]))
>                 --len;
> 
>         /* trim leading whitespace */
+	  if(len > 0) {
>         lws = strspn(s, " \n\r\t\v");
>         len -= lws;
>         memmove(s, s + lws, len);
+	  }
>         s[len] = 0;
> }
> 
> 
> is perfect?


--w
vodz



More information about the busybox mailing list