16 int main(
int argc,
char **argv) {
24 "arb_export_tree - exports tree from running ARB to stdout\n"
25 "syntax: arb_export_tree [--bifurcated] TREE_NAME [DBNAME]\n"
26 " --bifurcated write a bifurcated tree (default is a trifurcated tree)\n"
27 " --nobranchlens do not write branchlengths\n"
28 " --doublequotes use doublequotes (default is singlequotes)\n"
30 "Note: If TREE_NAME is '\?\?\?\?' or '' an empty tree is written.\n"
31 " If DBNAME is not specified, the default DB server ':' will be used.\n"
37 bool trifurcated =
true;
38 bool branchlens =
true;
39 bool doublequotes =
false;
40 const char *tree_name =
NULp;
41 const char *db_name =
NULp;
43 for (
int a = 1; a < argc && !
error; a++) {
44 if (strcmp(argv[a],
"--bifurcated") == 0) trifurcated =
false;
45 else if (strcmp(argv[a],
"--nobranchlens") == 0) branchlens =
false;
46 else if (strcmp(argv[a],
"--doublequotes") == 0) doublequotes =
true;
48 if (!tree_name) tree_name = argv[a];
49 else if (!db_name) db_name = argv[a];
56 if (!tree_name && !error) error =
"Missing argument TREE_NAME";
59 if (!db_name) db_name =
":";
71 error =
TREE_export_tree(gb_main, stdout, tree, trifurcated, branchlens, doublequotes);
86 if (!error) fprintf(stdout,
";\n");
92 fprintf(stderr,
"\narb_export_tree: Error: %s\n", error);
GB_ERROR TREE_export_tree(GBDATA *, FILE *out, TreeNode *tree, bool triple_root, bool export_branchlens, bool dquot)
TreeNode * GBT_read_tree(GBDATA *gb_main, const char *tree_name, TreeRoot *troot)
const char * GBS_global_string(const char *templat,...)
void warning(int warning_num, const char *warning_message)
GBDATA * GBT_open(const char *path, const char *opent)
GB_ERROR GB_await_error()
static void error(const char *msg)
int main(int argc, char **argv)
void GBT_message(GBDATA *gb_main, const char *msg)
GB_transaction ta(gb_var)
void destroy(TreeNode *that)
void ARB_redirect_handlers_to(FILE *errStream, FILE *outStream)
char * GBS_global_string_copy(const char *templat,...)
void GB_close(GBDATA *gbd)