/* parse arguments of export command */ static int runexport(int argc, char **argv){ char *upath = NULL; uint64_t ts = 0; uint32_t sid = UINT32_MAX; for(int i = 2; i < argc; i++){ if(!upath && argv[i][0] == '-'){ if(!strcmp(argv[i], "-ts")){ if(++i >= argc) usage(); ts = ttstrtots(argv[i]); } else if(!strcmp(argv[i], "-sid")){ if(++i >= argc) usage(); sid = tcatoi(argv[i]); } else { usage(); } } else if(!upath){ upath = argv[i]; } else { usage(); } } if(!upath) usage(); int rv = procexport(upath, ts, sid); return rv; }
/* parse arguments of export command */ static int runexport(int argc, char **argv){ char *dbpath = NULL; char *idstr = NULL; char *dirpath = NULL; for(int i = 2; i < argc; i++){ if(!dbpath && argv[i][0] == '-'){ if(!strcmp(argv[i], "-dir")){ if(++i >= argc) usage(); dirpath = argv[i]; } else { usage(); } } else if(!dbpath){ dbpath = argv[i]; } else if(!idstr){ idstr = argv[i]; } else { usage(); } } if(!dbpath) usage(); int64_t id = idstr ? tcatoi(idstr) : 0; int rv = procexport(dbpath, id, dirpath); return rv; }