Python's shlex but in C.
#include <stdio.h>
#define SHLEX_IMPLEMENTATION
#include "shlex.h"
int main(void)
{
const char *source = "-C link-args=\"-lm -L.\"";
Shlex s = {0};
shlex_init(&s, source, source + strlen(source));
while (shlex_next(&s)) {
printf("%s\n", s.string);
}
shlex_free(&s);
return 0;
}
#include <stdio.h>
#define SHLEX_IMPLEMENTATION
#include "shlex.h"
int main(void)
{
Shlex s = {0};
shlex_append_quoted(&s, "-C");
shlex_append_quoted(&s, "link-args=-lm -L.");
printf("%s\n", shlex_join(&s));
shlex_free(&s);
return 0;
}