for (bufsize = BUFMAX; bufsize > 2048; bufsize -= 2048 ) if ((buffer = malloc((unsigned int)bufsize))!= NULL ) break;