rizin/test/unit/legacy_unit/util/argv.c
2021-01-21 22:05:44 +08:00

24 lines
552 B
C

#include <rz_util.h>
static void test(const char *str) {
int i, argc;
char **argv = rz_str_argv(str, &argc);
printf("[%s]\n", str);
for (i = 0; i < argc; i++)
printf(" - %s\n", argv[i]);
rz_str_argv_free(argv);
}
int main() {
char buf[256];
int len = rz_str_bits(buf, (const ut8 *)"012345", 7 * 8, NULL);
printf("%d: %s\n", len, buf);
test(" hello world ");
test("hello world");
test("hello \"world\"");
test("'hello world'");
test("/bin/ls -l 'food is pure bar' \"barra cow is low\"");
test("'hello' \"world\"");
return 0;
}