- Add detailed build and bootstrap instructions to README.md. - Convert all source and header files from .c/.h to .c.md/.h.md. - Add bootstrap.sh script for automated building across version history. - Update Makefile and sources.mk to reflect new markdown-based source organization.
625 B
625 B
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "utils.h"
char *
extract_fence_ext(const char *fence)
{
const char *start;
const char *end;
size_t len;
char *ext;
if (0 != strncmp(fence, "```", 3))
return (NULL);
start = fence + 3;
while (' ' == *start || '\t' == *start)
start++;
if ('\n' == *start || '\0' == *start)
return (NULL);
end = start;
while ('\n' != *end && '\0' != *end && ' ' != *end && '\t' != *end)
end++;
len = (size_t)(end - start);
ext = malloc(len + 1);
if (NULL == ext)
return (NULL);
memcpy(ext, start, len);
ext[len] = '\0';
return (ext);
}