Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
struct pollfd fds[] = {
{ .fd = fileno(stdin), .events = POLLIN }
};
- char *p;
size_t sz;
int ret = 0;
/*
* cleanup the reply
*/
- for (p = buf; *p && !isgraph(*p); p++); /* get first non-blank */
-
- if (p > buf)
- memmove(buf, p, strlen(p) + 1); /* remove blank space */
- sz = strlen(buf);
+ sz = ltrim_whitespace((unsigned char *) buf);
if (sz && *(buf + sz - 1) == '\n')
*(buf + sz - 1) = '\0';
len = strlen((char *) p);
- if (len && p > str)
+ if (p > str)
memmove(str, p, len + 1);
return len;