Looks to me like you failed to set the first character in buf to a non-zero value. Here's a patch. ..wayne..