21 printf(
"arb_write_tree_comment: %s\n", msg);
29 fputs(
"Usage: arb_write_tree_comment [options] treeName textToAppend\n"
30 "Purpose: appends 'textToAppend' to comment of existing tree 'treeName'\n"
31 "Available options:\n"
32 " -db database savename specify database and savename (default is 'running ARB')\n"
33 " -plain do NOT prefix timestamp before textToAppend\n"
55 #define SHIFT_ARGS(off) do { argc -= off; argv += off; } while (0)
56 #define SHIFT_NONSWITCHES(off) do { nonSwitches -= off; nonSwitch += off; } while (0)
61 const char *nonSwitch_buf[20];
62 const char **nonSwitch = nonSwitch_buf;
67 while (argc>0 && !error) {
68 if (strcmp(
"-db", argv[0]) == 0) {
69 if (argc<3) error =
"-db expects two arguments (database and savename)";
76 else if (strcmp(
"-plain", argv[0]) == 0) {
81 nonSwitch[nonSwitches++] = argv[0];
87 if (!nonSwitches) error =
"Missing argument 'treeName'";
89 tree_name = nonSwitch[0];
94 if (!nonSwitches) error =
"Missing argument 'textToAppend'";
100 if (!error && nonSwitches>0) {
107 int main(
int argc,
char **argv) {
112 bool connectToArb = strcmp(param.
dbname,
":") == 0;
115 if (!error || connectToArb) {
117 if (connectToArb) gb_msg_main =
gb_main;
123 if (connectToArb) error =
"you have to start an arbdb server first";
133 if (!error && !connectToArb) {
GBDATA * GB_open(const char *path, const char *opent)
const char * GBS_global_string(const char *templat,...)
GB_ERROR scan(int argc, char **argv)
GB_ERROR GB_await_error()
GB_ERROR GB_save_as(GBDATA *gbd, const char *path, const char *savetype)
static void error(const char *msg)
fputs(TRACE_PREFIX, stderr)
void GBT_message(GBDATA *gb_main, const char *msg)
GB_ERROR GBT_log_to_named_trees_remark(GBDATA *gb_main, const char *tree_name, const char *log_entry, bool stamp)
void GB_close(GBDATA *gbd)