| char * xsubstring (const char *str, size_t len); FWIW, looking at my code again, I see that it was convenient to be able to pass in two pointers, const char *start and const char *end, and the function extracts what is between them.
char *
substring (const char *start, const char *end)
{
char *result = xmalloc (end - start + 1);
char *scan_result = result;
const char *scan = start;
while (scan < end)
*scan_result++ = *scan++;
*scan_result = 0;
return result;
}
