#include "strvec.h" #include "allocator.h" #include #include #include #define LIBSTRVEC_ERR(rc) errx(1, "libstrvec: %s", strerror(-rc)) int main(int argc, const char **argv) { struct strvec *strvec; const char **arg; strvec = strvec_alloc(0, &stdlib_strict_heap_allocator, NULL); if (!argc) return 1; for (arg = &argv[1]; *arg; arg++) { strvec_push(strvec, *arg); } strvec_push(strvec, "--"); strvec_push(strvec, "end"); strvec_push(strvec, NULL); for (arg = strvec_stra(strvec); *arg; arg++) { printf("%s\n", *arg); } strvec_free(strvec); }