15 fprintf(stderr,
"arb_sub2ascii: Error: %s\n", error);
22 fputs(
"arb_sub2ascii - extract part of database into ascii database\n"
23 "(intended to support fine-grained results in unit-tests)\n"
24 "Syntax: arb_sub2ascii 'srcDB' 'path/to/container' 'dstDB'\n"
25 "Opens arb-database 'srcDB', searches a container using the specified\n"
26 "search path and dumps its contents in arb ascii format to 'dstDB'\n",
35 bool not_enough_args = argc<4;
36 bool help_requested = argc>1 && strcmp(argv[1],
"--help") == 0;
38 if (not_enough_args || help_requested) {
42 const char *srcname = argv[1];
43 const char *path = argv[2];
44 const char *dstname = argv[3];
54 gb_dst =
GB_open(dstname,
"cw");
64 error =
GBS_global_string(
"could not find a container at '%s' in database '%s'", path, srcname);
71 if (!error) error =
GB_save_as(gb_dst, dstname,
"a");
GBDATA * GB_open(const char *path, const char *opent)
int ARB_main(int argc, char *argv[])
const char * GBS_global_string(const char *templat,...)
GB_ERROR GB_await_error()
GB_ERROR GB_save_as(GBDATA *gbd, const char *path, const char *savetype)
static void error(const char *msg)
static int show_usage(const char *error)
fputs(TRACE_PREFIX, stderr)
static int fail_if_error(const char *error)
GB_ERROR GB_copy_dropMarksAndTempstate(GBDATA *dest, GBDATA *source)
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
void GB_close(GBDATA *gbd)