33#define PI_LONG (1 << 0)
34#define PI_RECURSIVE (1 << 1)
35#define PI_VALUE (1 << 2)
36#define PI_HEX (1 << 3)
37#define PI_PAUSE (1 << 4)
68 printf(
"Database commands ([] are options, <> are placeholders):\n\n");
69 printf(
"alarm - reset all alarms\n");
70 printf(
"cd <dir> - change current directory\n");
71 printf(
"chat - enter chat mode\n");
72 printf(
"chmod <mode> <key> - change access mode of a key\n");
73 printf(
" 1=read | 2=write | 4=delete\n");
74 printf(
"cleanup [client] [-f] - delete hanging clients [force]\n");
75 printf(
"copy <src> <dest> - copy a subtree to a new location\n");
76 printf(
"create <type> <key> - create a key of a certain type\n");
77 printf(
"create <type> <key>[n] - create an array of size [n]\n");
78 printf(
"create string <key>[n][m] - create an array of [n] strings of [m] characters\n");
79 printf(
"del/rm [-f] <key> - delete a key and its subkeys\n");
80 printf(
" -f force deletion without asking\n");
81 printf(
"exec <key>/<cmd> - execute shell command (stored in key) on server\n");
82 printf(
"exp <key> <filename> - import key into ASCII file\n");
83 printf(
"find <pattern> - find a key with wildcard pattern\n");
84 printf(
"help/? [command] - print this help [for a specific command]\n");
85 printf(
"hi [analyzer] [id] - tell analyzer to clear histos\n");
86 printf(
"imp <filename> [key] - import ASCII file into string key\n");
87 printf(
"json <odb path> - print \"ODB save\" encoding of current directory or given odb path\n");
88 printf(
"jsls - print \"ls\" encoding of current directory\n");
89 printf(
"jsvalues - print \"get_values\" encoding of current directory\n");
90 printf(
"ln <source> <linkname> - create a link to <source> key\n");
91 printf(
"load <file> - load database from .ODB file at current position\n");
92 printf(
"-- hit return for more --\r");
94 printf(
"ls/dir [-lhvrp] [<pat>] - show database entries which match pattern\n");
95 printf(
" -l detailed info\n");
96 printf(
" -h hex format\n");
97 printf(
" -v only value\n");
98 printf(
" -r show database entries recursively\n");
99 printf(
" -p pause between screens\n");
100 printf(
"make [analyzer name] - create experim.h\n");
101 printf(
"mem [-v] - show memeory usage [verbose]\n");
102 printf(
"mkdir <subdir> - make new <subdir>\n");
103 printf(
"move <key> [top/bottom/[n]] - move key to position in keylist\n");
104 printf(
"msg [user] <msg> - send chat message (from interactive odbedit)\n");
105 printf(
"msg <facility> <type> <name> <msg> - send message to [facility] log\n");
106 printf(
"old [n] - display old n messages\n");
107 printf(
"passwd - change MIDAS password\n");
108 printf(
"pause - pause current run\n");
109 printf(
"pwd - show current directory\n");
110 printf(
"resume - resume current run\n");
111 printf(
"rename <old> <new> - rename key\n");
112 printf(
"-- hit return for more --\r");
114 printf(
"save [-c -s -x -j -cs] <file> - save database at current position\n");
115 printf(
" in ASCII format\n");
116 printf(
" -c as a C structure\n");
117 printf(
" -s as a #define'd string\n");
118 printf(
" -x as an XML file, or use file.xml\n");
119 printf(
" -j as a JSON file, or use file.json\n");
120 printf(
" -z as value-only JSON file\n");
121 printf(
"set <key> <value> - set the value of a key\n");
122 printf(
"set <key>[i] <value> - set the value of index i\n");
123 printf(
"set <key>[*] <value> - set the value of all indices of a key\n");
124 printf(
"set <key>[i..j] <value> - set the value of all indices i..j\n");
125 printf(
"scl [-w] - show all active clients [with watchdog info]\n");
126 printf(
"shutdown <client>/all - shutdown individual or all clients\n");
127 printf(
"sor - show open records in current subtree\n");
128 printf(
"start [number][now][-v] - start a run [with a specific number],\n");
129 printf(
" [now] w/o asking parameters, [-v] debug output\n");
130 printf(
"stop [-v] - stop current run, [-v] debug output\n");
131 printf(
"test_rpc - test mserver RPC connection and parameter encoding and decoding\n");
132 printf(
"trunc <key> <index> - truncate key to [index] values\n");
133 printf(
"ver - show MIDAS library version\n");
134 printf(
"webpasswd - change WWW password for mhttpd\n");
135 printf(
"wait <key> - wait for key to get modified\n");
136 printf(
"watch <key> - watch key or ODB tree to be modified\n");
138 printf(
"\nquit/exit - exit\n");
143 printf(
"cd <dir> - change current directory. Use \"cd /\" to change to the root\n");
144 printf(
" of the ODB, \"cd ..\" to change to the parent directory.\n");
146 printf(
"chat - enter chat mode. In this mode, users can \"talk\" to each other.\n");
147 printf(
" Each user running ODBEdit connected to the same experiment can see\n");
148 printf(
" the other messages and each user running ODBEdit in chat mode can\n");
149 printf(
" produce messages. All messages are logged in the MIDAS logging file.\n");
151 printf(
"No specific help available for command \"%s\".\n", command);
164 assert(
sizeof(
str) >= 32);
170 printf(
"\r%s %s\n",
str + 11, (
char *)
message);
172 printf(
"\n%s %s\n",
str + 11, (
char *)
message);
179 printf(
"\r%s\n", msg);
193 return *pat ==
'*' ?
match(pat + 1,
str) : !*pat;
203 return (toupper(*pat) == toupper(*
str)) &&
match(pat + 1,
str + 1);
214 if ((flags &
PI_PAUSE) && (l % 24) == 23) {
215 printf(
"Press any key to continue or q to quit ");
244 while (s->length() < pos)
258 memcpy(&
key, pkey,
sizeof(
KEY));
272 std::string xdata_str;
276 if (strlen(buf) > 0 && buf[strlen(buf) - 1] ==
']')
295 xdata_str =
"<cannot resolve link>";
297 xdata_str =
"<no read access>";
305 if ((
pi->index != -1 &&
i ==
pi->index) ||
pi->index == -1)
306 printf(
"%s\n", xdata_str.c_str());
331 xline +=
" -> (empty)";
333 if (
pi->index != -1) {
336 xline += std::to_string(
pi->index);
339 if (xline.length() >= 32) {
340 printf(
"%s\n", xline.c_str());
347 if (
pi->index != -1) {
360 printf(
"%s\n", xline.c_str());
364 char *data_buf = NULL;
374 std::string xdata_str;
378 if (strlen(data_buf) > 0 && data_buf[strlen(data_buf) - 1] ==
']')
402 xdata_str =
"<subdirectory>";
404 xdata_str =
"<cannot resolve link>";
406 xdata_str =
"<no read access>";
408 xdata_str =
"<empty>";
447 else if (delta < 3600)
448 xline +=
msprintf(
"%1.0lfm", delta / 60.0);
449 else if (delta < 86400)
450 xline +=
msprintf(
"%1.0lfh", delta / 3600.0);
451 else if (delta < 86400 * 99)
452 xline +=
msprintf(
"%1.0lfh", delta / 86400.0);
484 xline +=
"<multi-line>";
490 xline +=
"<multi-line>";
496 printf(
"%s\n", xline.c_str());
499 puts(xdata_str.c_str());
512 xdata_str =
"<empty>";
521 yline += std::to_string(
i);
531 if ((
pi->index != -1 &&
i ==
pi->index) ||
pi->index == -1)
532 printf(
"%s\n", yline.c_str());
578 printf(
"Write access not allowed\n");
593 static char data_str[256], line[256];
618 strcpy(data_str,
"<no read access>");
621 std::string data_str;
626 printf(
"%s\n", data_str.c_str());
631 printf(
"XXX here!\n");
633 memset(line,
' ', 80);
635 sprintf(line + level * 4,
"%s",
key.
name);
636 line[strlen(line)] =
' ';
640 printf(
"%s\n", line);
647 strcpy(data_str,
"<no read access>");
657 line[strlen(line)] =
' ';
659 line[strlen(line)] =
' ';
661 line[strlen(line)] =
' ';
665 sprintf(line + 52,
"%ds", delta);
666 else if (delta < 3600)
667 sprintf(line + 52,
"%1.0lfm", delta / 60.0);
668 else if (delta < 86400)
669 sprintf(line + 52,
"%1.0lfh", delta / 3600.0);
670 else if (delta < 86400 * 99)
671 sprintf(line + 52,
"%1.0lfh", delta / 86400.0);
673 sprintf(line + 52,
">99d");
674 line[strlen(line)] =
' ';
677 line[strlen(line)] =
' ';
689 strcpy(line + 66, data_str);
693 strcpy(line + 32, data_str);
697 printf(
"%s\n", line);
701 std::string data_str;
708 memset(line,
' ', 80);
712 sprintf(line + 40,
"[%d]",
j);
713 line[strlen(line)] =
' ';
715 strcpy(line + 56, data_str);
717 strcpy(line + 32, data_str);
719 printf(
"%s\n", line);
735 scan_tree(
hDB,
hSubkey, total_size_key, total_size_data, level + 1, flags);
754 char *pc, partial[256], last_match[256];
755 char head[256], tail[256], key_name[256],
c;
757 BOOL blanks, mismatch;
763 strcpy(tail, line + *cursor);
769 while (*pc && *pc !=
' ')
771 while (*pc && *pc ==
' ')
773 }
while (*pc ==
'-');
776 strcpy(key_name, pc);
782 if (strncmp(head,
"set", 3) == 0 && strlen(key_name) > 0) {
784 if (key_name[0] ==
'"')
785 ystr = (key_name + 1);
788 if (key_name[0] !=
'/') {
789 strcpy(test_key,
pwd);
790 if (test_key[strlen(test_key) - 1] !=
'/')
791 strcat(test_key,
"/");
792 strcat(test_key, ystr.c_str());
794 strcpy(test_key, ystr.c_str());
797 pc = test_key + strlen(test_key) - 1;
798 while (pc > test_key && (*pc ==
' ' || *pc ==
'"'))
806 if (strlen(key_name) > 0 && key_name[strlen(key_name) - 1] !=
' ')
807 strcat(key_name,
" ");
827 strcat(line, key_name);
828 strcat(line, xstr.c_str());
829 *cursor = strlen(line);
846 if (
str[strlen(
str) - 1] !=
'/')
853 for (pc =
str + strlen(
str) - 1; pc >
str && *pc !=
'/'; pc--)
858 strcpy(partial, pc + 1);
860 strcpy(partial,
str);
872 str[strlen(partial)] = 0;
890 str[strlen(partial)] = 0;
896 if (strlen(key_name) > 0)
897 for (pc = key_name + strlen(key_name) - 1; pc > key_name && *pc !=
'/';
909 if (key_name[0] !=
'"') {
910 for (
i = strlen(key_name);
i >= 0;
i--)
911 key_name[
i + 1] = key_name[
i];
916 strcat(key_name,
"\"");
920 if (key_name[0] ==
'"' && key_name[strlen(key_name) - 1] !=
'"')
927 strcat(line, key_name);
928 *cursor = strlen(line);
937 if (
match > 1 && key_name[0]) {
940 for (
j = strlen(partial);;
j++) {
941 for (
i = 0,
c = 1, mismatch =
FALSE;;
i++) {
950 str[strlen(partial)] = 0;
966 if (mismatch || last_match[
j] == 0)
971 for (pc = key_name + strlen(key_name) - 1; pc > key_name && *pc !=
'/'; pc--)
976 for (
i = 0;
i <
j;
i++)
977 pc[
i] = last_match[
i];
982 if (key_name[0] !=
'"') {
983 for (
i = strlen(key_name);
i >= 0;
i--)
984 key_name[
i + 1] = key_name[
i];
991 strcat(line, key_name);
992 *cursor = strlen(line);
1001 strcat(line, key_name);
1002 *cursor = strlen(line);
1010 char *pattern = (
char *)
info;
1014 std::string line = path +
" : ";
1022 std::string data_str;
1025 data_str =
"<no read access>";
1032 printf(
"%s\n", line.c_str());
1038 printf(
" [%d] : %s\n",
i, data_str.c_str());
1042 printf(
"%s\n", line.c_str());
1066 if (rand() < RAND_MAX / 10)
1073static void xwrite(
const char *filename,
int fd,
const void *
data,
int size) {
1076 cm_msg(
MERROR,
"xwrite",
"cannot write to \'%s\', write(%d) returned %d, errno %d (%s)", filename, size, wr, errno, strerror(errno));
1082 HNDLE hKey, hKeyRoot, hKeyEq, hDefKey, hKeyBank, hKeyPar;
1083 char str[100 + 80], eq_name[80], subeq_name[80];
1087 char experim_h_comment1[] =
1088 "/********************************************************************\\\n\
1091 Created by: ODBedit program\n\
1093 Contents: This file contains C structures for the \"Experiment\"\n\
1094 tree in the ODB and the \"/Analyzer/Parameters\" tree.\n\
1096 Additionally, it contains the \"Settings\" subtree for\n\
1097 all items listed under \"/Equipment\" as well as their\n\
1098 event definition.\n\
1100 It can be used by the frontend and analyzer to work\n\
1101 with these information.\n\
1103 All C structures are accompanied with a string represen-\n\
1104 tation which can be used in the db_create_record function\n\
1105 to setup an ODB structure which matches the C structure.\n\
1107 char experim_h_comment2[] =
1108 "\\********************************************************************/\n\n";
1113 hfile = open(
file_name, O_WRONLY | O_CREAT | O_TRUNC, 0644);
1115 cm_msg(
MERROR,
"create_experim_h",
"cannot open experim.h file.");
1118 xwrite(
file_name, hfile, experim_h_comment1, strlen(experim_h_comment1));
1121 ctime_r(&now, ctimebuf);
1122 sprintf(
str,
" Created on: %s\n", ctimebuf);
1124 xwrite(
file_name, hfile, experim_h_comment2, strlen(experim_h_comment2));
1129 sprintf(
str,
"#define EXP_PARAM_DEFINED\n\n");
1133 lseek(hfile, 0, SEEK_END);
1139 sprintf(
str,
"#define EXP_EDIT_DEFINED\n\n");
1143 lseek(hfile, 0, SEEK_END);
1150 printf(
"Analyzer \"%s\" not found in ODB, skipping analyzer parameters.\n",
1159 mstrlcpy(eq_name,
key.
name,
sizeof(eq_name));
1161 for (
i = 0;
i < (int) strlen(eq_name);
i++)
1162 eq_name[
i] = toupper(eq_name[
i]);
1164 lseek(hfile, 0, SEEK_END);
1165 sprintf(
str,
"#ifndef EXCL_%s\n\n", eq_name);
1168 sprintf(
str,
"#define %s_PARAM_DEFINED\n\n", eq_name);
1170 sprintf(
str,
"%s_PARAM", eq_name);
1172 sprintf(
str,
"%s_PARAM_STR", eq_name);
1175 lseek(hfile, 0, SEEK_END);
1176 sprintf(
str,
"#endif\n\n");
1192 for (
i = 0;
i < (int) strlen(eq_name);
i++)
1193 eq_name[
i] = toupper(eq_name[
i]);
1195 lseek(hfile, 0, SEEK_END);
1196 sprintf(
str,
"#ifndef EXCL_%s\n\n", eq_name);
1207 lseek(hfile, 0, SEEK_END);
1208 sprintf(
str,
"#define %s_EVENT_DEFINED\n\n", eq_name);
1211 sprintf(
str,
"%s_EVENT", eq_name);
1213 sprintf(
str,
"%s_EVENT_STR", eq_name);
1230 lseek(hfile, 0, SEEK_END);
1231 sprintf(
str,
"#define %s_BANK_DEFINED\n\n",
key.
name);
1244 for (subindex = 0;; subindex++) {
1253 for (
i = 0;
i < (int) strlen(subeq_name);
i++)
1254 subeq_name[
i] = toupper(subeq_name[
i]);
1258 lseek(hfile, 0, SEEK_END);
1259 sprintf(
str,
"#define %s_%s_DEFINED\n\n", eq_name, subeq_name);
1262 sprintf(
str,
"%s_%s", eq_name, subeq_name);
1264 sprintf(
str,
"%s_%s_STR", eq_name, subeq_name);
1269 lseek(hfile, 0, SEEK_END);
1270 sprintf(
str,
"#endif\n\n");
1277 printf(
"\"experim.h\" has been written to %s/%s\n", cwd.c_str(),
file_name);
1292 printf(
"Server connection broken.\n");
1308 if (
name[0] !=
'/') {
1309 strcpy(full_name,
pwd);
1310 if (full_name[strlen(full_name) - 1] !=
'/')
1311 strcat(full_name,
"/");
1312 strcat(full_name,
name);
1314 strcpy(full_name,
name);
1326 const char *state_char[] = {
"U",
"S",
"P",
"R"};
1327 const char *state_str[] = {
"Unknown",
"Stopped",
"Paused",
"Running"};
1331 size =
sizeof(
mask);
1332 strcpy(
mask,
"[%h:%e:%s]%p>");
1336 size =
sizeof(
state);
1343 memset(prompt, 0, psize);
1351 assert(
sizeof(
str) >= 32);
1354 strcpy(pp,
str + 11);
1360 strcat(pp,
"local");
1366 strcat(pp,
"Default");
1369 strcat(pp, state_char[
state]);
1372 strcat(pp, state_str[
state]);
1378 pc =
pwd + strlen(
pwd) - 1;
1379 while (*pc !=
'/' && pc !=
pwd)
1403 printf(
"callback for invalid or deleted hkey %d odb path %s\n",
hKey, path.c_str());
1408 printf(
"%s modified\n", path.c_str());
1414 printf(
"%s = \"%s\"\n", path.c_str(),
data.c_str());
1417 int size =
sizeof(
data);
1420 printf(
"%s = %s\n", path.c_str(),
str.c_str());
1424 printf(
"%s[*] modified\n", path.c_str());
1429 printf(
"%s[%d] = \"%s\"\n", path.c_str(),
index,
data.c_str());
1432 int size =
sizeof(
data);
1435 printf(
"%s[%d] = %s\n", path.c_str(),
index,
str.c_str());
1446 char line[2000], prompt[256];
1447 char param[10][2000];
1448 char str[2000], str2[80],
name[256], *pc;
1449 char old_password[32], new_password[32];
1450 INT nparam, flags, index1, index2, debug_flag, mthread_flag;
1454 char user_name[80] =
"";
1455 FILE *cmd_file = NULL;
1456 DWORD last_msg_time = 0;
1457 char message[2000], client_name[256], *p;
1465 strcpy(
pwd, start_dir);
1471 printf(
"Directory \"%s\" not found.\n",
pwd);
1476 if (cmd[0] ==
'@') {
1477 cmd_file = fopen(cmd + 1,
"r");
1478 if (cmd_file == NULL) {
1479 printf(
"Command file %s not found.\n", cmd + 1);
1493 }
else if (cmd[0] !=
'@')
1494 mstrlcpy(line, cmd,
sizeof(line));
1496 memset(line, 0,
sizeof(line));
1497 char *s = fgets(line,
sizeof(line), cmd_file);
1499 if (s == NULL || line[0] == 0)
1503 while (strlen(line) > 0 && line[strlen(line) - 1] ==
'\n')
1504 line[strlen(line) - 1] = 0;
1520 for (
i = 0; *pc && *pc !=
'"' &&
i < (int)
sizeof(
param[0]) - 1;
i++)
1521 param[nparam][
i] = *pc++;
1524 }
else if (*pc ==
'\'') {
1526 for (
i = 0; *pc && *pc !=
'\'' &&
i < (int)
sizeof(
param[0]) - 1;
i++)
1527 param[nparam][
i] = *pc++;
1530 }
else if (*pc ==
'`') {
1532 for (
i = 0; *pc && *pc !=
'`' &&
i < (int)
sizeof(
param[0]) - 1;
i++)
1533 param[nparam][
i] = *pc++;
1537 for (
i = 0; *pc && *pc !=
' ' &&
i < (int)
sizeof(
param[0]) - 1;
i++)
1538 param[nparam][
i] = *pc++;
1550 else if ((
param[0][0] ==
'l' &&
param[0][1] ==
's') || (
param[0][0] ==
'd' &&
param[0][1] ==
'i')) {
1552 print_info.
flags = 0;
1558 for (
i = 1;
i < 4;
i++)
1559 if (
param[
i][0] ==
'-') {
1574 for (
i = 1;
param[
i][0] ==
'-';
i++)
1578 print_info.
index = -1;
1580 for (p = strchr(
param[
i],
'[') + 1; *p && *p !=
']'; p++)
1584 if (*p && *p ==
']') {
1585 print_info.
index = atoi(strchr(
param[
i],
'[') + 1);
1586 *strchr(
param[
i],
'[') = 0;
1591 if (strpbrk(
param[
i],
"*?") != NULL) {
1601 printf(
"key %s not found\n",
param[
i]);
1604 printf(
"link %s points to invalid location\n",
param[
i]);
1610 printf(
"Key name Type #Val Size Last Opn Mode Value\n");
1611 printf(
"---------------------------------------------------------------------------\n");
1644 else if (
param[0][0] ==
'c' &&
param[0][1] ==
'd') {
1645 if (strlen(
param[1]) == 0)
1652 if (strcmp(
str,
"/") == 0)
1657 printf(
"key has no subkeys\n");
1660 mstrlcpy(
pwd, path.c_str(),
sizeof(
pwd));
1663 printf(
"key not found\n");
1667 else if (
param[0][0] ==
'p' &&
param[0][1] ==
'w') {
1668 printf(
"%s\n",
pwd);
1672 else if (
param[0][0] ==
'c' &&
param[0][1] ==
'r') {
1679 if (
str[strlen(
str) - 1] ==
']') {
1680 if (strchr(
str,
'[')) {
1681 j = atoi(strchr(
str,
'[') + 1);
1682 mstrlcpy(str2, strchr(
str,
'[') + 1,
sizeof(str2));
1683 *strchr(
str,
'[') = 0;
1684 if (strchr(str2,
'['))
1685 k = atoi(strchr(str2,
'[') + 1);
1697 printf(
"Unknown type. Must be one of:\n");
1698 printf(
"{ UINT8,INT8,UINT16,INT16,UINT32,INT32,UINT64,INT64,BOOL,FLOAT,DOUBLE,STRING }\n");
1735 else if (
param[0][0] ==
'm' &&
param[0][1] ==
'k') {
1741 else if (
param[0][0] ==
'l' &&
param[0][1] ==
'n') {
1747 else if (
param[0][0] ==
'c' && (
param[0][1] ==
'o' ||
param[0][1] ==
'p')) {
1755 printf(
"Overwrite existing key\n\"%s\"\n(y/[n]) ",
str);
1782 size =
sizeof(
data);
1785 printf(
"error: db_copy() status %d, odbedit internal buffer is too small, size %d\n",
status, size);
1787 printf(
"error: db_copy() status %d\n",
status);
1794 printf(
"key not found\n");
1800 else if ((
param[0][0] ==
'd' &&
param[0][1] ==
'e') || (
param[0][0] ==
'r' &&
param[0][1] ==
'm')) {
1805 for (
i = 1;
param[
i][0] ==
'-';
i++)
1818 printf(
"Are you sure to delete the key\n\"%s\"\nand all its subkeys? (y/[n]) ",
1821 printf(
"Are you sure to delete the key\n\"%s\"\n(y/[n]) ",
str);
1826 if (
str[0] ==
'y') {
1829 printf(
"deletion of key not allowed\n");
1831 printf(
"key is open by other client\n");
1833 printf(
"Error, db_delete_key() status %d\n",
status);
1837 printf(
"key not found\n");
1841 else if (
param[0][0] ==
's' &&
param[0][1] ==
'e') {
1843 index1 = index2 = 0;
1848 std::vector<HNDLE> keys;
1852 printf(
"Error: Key \"%s\" not found\n",
name);
1856 for (
HNDLE hMatchedKey : keys) {
1863 else if (
param[0][0] ==
'c' &&
param[0][1] ==
'h' &&
param[0][2] ==
'm') {
1865 printf(
"Please specify mode and key\n");
1869 mode = atoi(
param[1]);
1871 if (strcmp(
str,
"/") != 0) {
1882 printf(
"Are you sure to change the mode of key\n %s\nand all its subkeys\n",
1884 printf(
"to mode [%c%c%c%c]? (y/[n]) ", mode &
MODE_READ ?
'R' : 0,
1892 printf(
"Error: Key \"%s\" not found\n",
str);
1900 else if (strcmp(
param[0],
"test_rpc") == 0) {
1903 printf(
"RPC test passed!\n");
1905 printf(
"RPC test failed!\n");
1909 else if (
param[0][0] ==
't' &&
param[0][1] ==
'r') {
1910 if (
param[1][0] == 0) {
1911 printf(
"Please specify key\n");
1924 printf(
"Error: Key \"%s\" not found\n",
str);
1932 else if (
param[0][0] ==
'r' &&
param[0][1] ==
'e' &&
param[0][2] ==
'n') {
1933 if (
param[1][0] == 0) {
1934 printf(
"Please specify key\n");
1938 if (strcmp(
str,
"/") != 0)
1946 printf(
"Error: Key \"%s\" not found\n",
str);
1954 else if (
param[0][0] ==
'm' &&
param[0][1] ==
'o') {
1955 if (
param[1][0] == 0) {
1956 printf(
"Please specify key\n");
1960 if (strcmp(
str,
"/") != 0)
1966 if (
param[2][0] ==
't')
1968 else if (
param[2][0] ==
'b')
1975 printf(
"no write access to key\n");
1977 printf(
"key is open by other client\n");
1979 printf(
"Error: Key \"%s\" not found\n",
str);
1987 else if (
param[0][0] ==
'f' &&
param[0][1] ==
'i') {
1993 printf(
"current key is invalid / no read access\n");
1997 else if (
param[0][0] ==
'l' &&
param[0][1] ==
'o') {
2004 else if (
param[0][0] ==
's' &&
param[0][1] ==
'a') {
2007 if (strstr(
param[1],
".xml") || strstr(
param[1],
".XML"))
2009 else if (strstr(
param[1],
".json") || strstr(
param[1],
".js"))
2011 else if (
param[1][0] ==
'-') {
2012 if (
param[1][1] ==
'c' &&
param[1][2] ==
's') {
2015 }
else if (
param[1][1] ==
'c')
2017 else if (
param[1][1] ==
's')
2019 else if (
param[1][1] ==
'x')
2021 else if (
param[1][1] ==
'j')
2023 else if (
param[1][1] ==
'z')
2031 else if (strncmp(
param[0],
"json", 8) == 0) {
2033 if (
param[1][0] ==
'/') {
2035 }
else if (strlen(
param[1]) > 0) {
2042 char *buffer = NULL;
2043 int buffer_size = 0;
2048 printf(
"status: %d, json: %s\n",
status, buffer);
2055 else if (strncmp(
param[0],
"jsvalues", 8) == 0) {
2058 char *buffer = NULL;
2059 int buffer_size = 0;
2063 int omit_last_written = 0;
2064 time_t omit_old_timestamp = 0;
2065 int preserve_case = 0;
2069 printf(
"status: %d, json: %s\n",
status, buffer);
2076 else if (strncmp(
param[0],
"jsls", 4) == 0) {
2078 if (
param[1][0] ==
'/') {
2080 }
else if (strlen(
param[1]) > 0) {
2087 char *buffer = NULL;
2088 int buffer_size = 0;
2093 printf(
"jsls \"%s\", status: %d, json: %s\n",
pwd,
status, buffer);
2100 else if (
param[0][0] ==
'm' &&
param[0][1] ==
'a') {
2108 else if (
param[0][0] ==
'p' &&
param[0][1] ==
'a' &&
param[0][2] ==
's') {
2116 size =
sizeof(old_password);
2122 if (strcmp(
str, old_password) == 0 || strcmp(
str,
"mid7qBxsNMHux") == 0) {
2127 if (strcmp(new_password,
ss_crypt(
str,
"mi")) != 0)
2128 printf(
"Mismatch - password unchanged\n");
2132 printf(
"Wrong password\n");
2138 if (strcmp(new_password,
ss_crypt(
str,
"mi")) != 0)
2139 printf(
"Mismatch - password not set\n");
2142 db_set_value(
hDB, 0,
"/Experiment/Security/Password", new_password, 32, 1,
2147 "/Experiment/Security/Allowed hosts/host.sample.domain",
2157 else if (
param[0][0] ==
'w' &&
param[0][1] ==
'e' &&
param[0][2] ==
'b') {
2159 size =
sizeof(old_password);
2165 if (strcmp(
str, old_password) == 0 || strcmp(
str,
"mid7qBxsNMHux") == 0) {
2170 if (strcmp(new_password,
ss_crypt(
str,
"mi")) != 0)
2171 printf(
"Mismatch - password unchanged\n");
2175 printf(
"Wrong password\n");
2181 if (strcmp(new_password,
ss_crypt(
str,
"mi")) != 0)
2182 printf(
"Mismatch - password not set\n");
2185 db_set_value(
hDB, 0,
"/Experiment/Security/Web Password", new_password, 32,
2191 else if (
param[0][0] ==
'h' &&
param[0][1] ==
'i') {
2196 if (!isalpha(
param[1][0])) {
2203 printf(
"No client currently exports the CLEAR HISTO functionality.\n");
2210 size =
sizeof(client_name);
2218 if (isdigit(
param[1][0]))
2219 n1 = atoi(
param[1]);
2223 if (isdigit(
param[2][0]))
2224 n2 = atoi(
param[2]);
2228 strcpy(client_name,
param[1]);
2230 if (isdigit(
param[2][0]))
2231 n1 = atoi(
param[2]);
2235 if (isdigit(
param[3][0]))
2236 n2 = atoi(
param[3]);
2241 if (client_name[0]) {
2246 printf(
"Cannot connect to client %s\n", client_name);
2251 else if (
param[0][0] ==
'i' &&
param[0][1] ==
'm') {
2254 printf(
"Could not open file \"%s\", errno %d (%s)\n",
param[1], errno, strerror(errno));
2256 off_t off = lseek(fh, 0, SEEK_END);
2258 printf(
"Could not get size of file \"%s\", lseek(SEEK_END) errno %d (%s)\n",
param[1], errno, strerror(errno));
2261 lseek(fh, 0, SEEK_SET);
2263 char *buf = (
char *) malloc(size + 1);
2264 ssize_t rd =
read(fh, buf, size);
2266 printf(
"Could not read file \"%s\", read(%zu) errno %d (%s)\n",
param[1], size, errno, strerror(errno));
2275 }
else if (buf[size - 1] != 0) {
2280 if (
param[2][0] == 0) {
2281 printf(
"Key name: ");
2300 else if (
param[0][0] ==
'e' &&
param[0][1] ==
'x' &&
param[0][2] ==
'p') {
2303 if (
param[1][0] == 0)
2304 printf(
"please specify key\n");
2310 printf(
"Error: Key \"%s\" not found\n",
param[1]);
2312 if (
param[2][0] == 0) {
2313 printf(
"File name: ");
2318 f = fopen(
name,
"w");
2320 printf(
"Cannot open file \"%s\"\n",
name);
2324 printf(
"Only export of STRING key possible\n");
2328 memset(buf, 0, size);
2330 fprintf(f,
"%s", buf);
2340 else if (
param[0][0] ==
'a' &&
param[0][1] ==
'l') {
2353 printf(
"Alarm of class \"%s\" reset sucessfully\n",
key.
name);
2359 else if (
param[0][0] ==
'm' &&
param[0][1] ==
'e') {
2361 printf(
"This function works only locally\n");
2363#ifdef LOCAL_ROUTINES
2367 printf(
"This MIDAS only works remotely\n");
2373 else if (
param[0][0] ==
's' &&
param[0][1] ==
'o') {
2381 else if (
param[0][0] ==
's' &&
param[0][1] ==
'c') {
2385 "cannot find System/Clients entry in database");
2387 if (
param[1][1] ==
'w')
2388 printf(
"Name Host Timeout Last called\n");
2390 printf(
"Name Host\n");
2399 size =
sizeof(
name);
2402 for (
int j = 0;
j < 20 - (int) strlen(
name);
j++)
2408 for (
int j = 0;
j < 20 - (int) strlen(
str);
j++)
2412 if (
param[1][1] ==
'w') {
2413 DWORD timeout, last;
2416 printf(
"%-10d %-10d", timeout, last);
2426 else if (
param[0][0] ==
's' &&
param[0][1] ==
't' &&
param[0][2] ==
'a') {
2427 debug_flag = ((
param[1][0] ==
'-' &&
param[1][1] ==
'v') || (
param[2][0] ==
'-' &&
param[2][1] ==
'v') || (
param[3][0] ==
'-' &&
param[3][1] ==
'v'));
2428 mthread_flag = ((
param[1][0] ==
'-' &&
param[1][1] ==
'm') || (
param[2][0] ==
'-' &&
param[2][1] ==
'm') || (
param[3][0] ==
'-' &&
param[3][1] ==
'm'));
2435 printf(
"Run is already started\n");
2437 printf(
"Run is paused, please use \"resume\"\n");
2443 assert(old_run_number >= 0);
2447 new_run_number = old_run_number + 1;
2465 if (
str.find(
"Options ") == 0)
2483 std::string xprompt;
2491 strcpy(line, xdata_str.c_str());
2507 new_run_number = old_run_number + 1;
2510 printf(
"Run number: %d\n", new_run_number);
2513 printf(
"Run number [%d]: ", new_run_number);
2515 if (line[0] && atoi(line) > 0)
2516 new_run_number = atoi(line);
2519 printf(
"Are the above parameters correct? ([y]/n/q): ");
2522 }
while (line[0] ==
'n' || line[0] ==
'N');
2525 if (line[0] !=
'q' && line[0] !=
'Q') {
2527 printf(
"Starting run #%d\n", new_run_number);
2529 assert(new_run_number > 0);
2537 sizeof(old_run_number), 1,
TID_INT);
2540 printf(
"Error: %s\n",
str);
2547 else if (
param[0][0] ==
's' &&
param[0][1] ==
't' &&
param[0][2] ==
'o') {
2548 debug_flag = ((
param[1][0] ==
'-' &&
param[1][1] ==
'v') || (
param[2][0] ==
'-' &&
param[2][1] ==
'v') || (
param[3][0] ==
'-' &&
param[3][1] ==
'v'));
2549 mthread_flag = ((
param[1][0] ==
'-' &&
param[1][1] ==
'm') || (
param[2][0] ==
'-' &&
param[2][1] ==
'm') || (
param[3][0] ==
'-' &&
param[3][1] ==
'm'));
2557 printf(
"Run is already stopped. Stop again? (y/[n]) ");
2561 if (
param[1][0] ==
'n')
2568 printf(
"%s\n",
str);
2570 printf(
"Deferred stop already in progress, enter \"stop now\" to force stop\n");
2572 printf(
"Error: %s\n",
str);
2577 else if (
param[0][0] ==
'p' &&
param[0][1] ==
'a' &&
param[0][2] ==
'u') {
2578 debug_flag = ((
param[1][0] ==
'-' &&
param[1][1] ==
'v') || (
param[2][0] ==
'-' &&
param[2][1] ==
'v'));
2585 printf(
"Run is not started\n");
2587 if (
param[1][0] ==
'n')
2593 printf(
"%s\n",
str);
2595 printf(
"Deferred pause already in progress, enter \"pause now\" to force pause\n");
2597 printf(
"Error: %s\n",
str);
2602 else if (
param[0][0] ==
'r' &&
param[0][1] ==
'e' &&
param[0][2] ==
's') {
2603 debug_flag = ((
param[1][0] ==
'-' &&
param[1][1] ==
'v') || (
param[2][0] ==
'-' &&
param[2][1] ==
'v'));
2610 printf(
"Run is not paused\n");
2614 printf(
"Error: %s\n",
str);
2619 else if (
param[0][0] ==
'm' &&
param[0][1] ==
's') {
2622 printf(
"Error: Not enough parameters. Please use\n\n");
2623 printf(
" msg <facility> <type> <name> <message>\n\n");
2624 printf(
"where <facility> can be \"midas\", \"chat\", ...\n");
2625 printf(
"and <type> must be \"error\", \"info\", \"debug\", \"user\", \"log\", \"talk\" or \"call\".\n");
2643 printf(
"Error: inavlid type \"%s\".\n",
param[2]);
2644 printf(
"<type> must be one of \"error\", \"info\", \"debug\", \"user\", \"log\", \"talk\", \"call\".\n");
2654 else if (
param[0][0] ==
'c' &&
param[0][1] ==
'h' &&
param[0][2] ==
'a') {
2657 if (
ss_time() - last_msg_time > 300) {
2658 printf(
"Your name> ");
2662 printf(
"Exit chat mode with empty line.\n");
2678 else if (
param[0][0] ==
'o' &&
param[0][1] ==
'l') {
2685 printf(
"%s\n\n",
data);
2689 else if (
param[0][0] ==
'c' &&
param[0][1] ==
'l') {
2694 if (
param[1][0] ==
'-' &&
param[1][1] ==
'f')
2696 if (
param[2][0] ==
'-' &&
param[2][1] ==
'f')
2709 else if (
param[0][0] ==
's' &&
param[0][1] ==
'h') {
2710 if (
param[1][0] == 0)
2711 printf(
"Please enter client name or \"all\" to shutdown all clients.\n");
2715 if (strcmp(
param[1],
"all") == 0)
2716 printf(
"No clients found\n");
2718 printf(
"Client \"%s\" not active\n",
param[1]);
2724 else if (
param[0][0] ==
'v' &&
param[0][1] ==
'e') {
2731 else if (
param[0][0] ==
'e' &&
param[0][1] ==
'x' &&
param[0][2] ==
'e') {
2738 printf(
"Key contains no command\n");
2752 else if (
param[0][0] ==
'w' &&
param[0][1] ==
'a' &&
param[0][2] ==
'i') {
2753 if (
param[1][0] == 0) {
2754 printf(
"Please specify key\n");
2766 printf(
"Waiting for key \"%s\" to be modified, abort with any key\n",
key.
name);
2768 char *buf = (
char *) malloc(size);
2791 printf(
"Wait aborted.\n");
2793 printf(
"Key has been modified.\n");
2795 printf(
"key \"%s\" not found\n",
str);
2800 else if (
param[0][0] ==
'w' &&
param[0][1] ==
'a' &&
param[0][2] ==
't') {
2801 if (
param[1][0] == 0) {
2802 printf(
"Please specify key\n");
2810 printf(
"Watch key \"%s\" to be modified, abort with any key\n",
str);
2812 printf(
"Watch ODB tree \"%s\" to be modified, abort with any key\n",
str);
2829 printf(
"key \"%s\" not found\n",
str);
2834 else if (
param[0][0] ==
't' &&
param[0][1] ==
'1') {
2859 printf(
"%d accesses per second\n",
i / 5);
2863 else if (
param[0][0] ==
't' &&
param[0][1] ==
'2') {
2868 }
while (
i > 0 &&
i != 4);
2877 else if (
param[0][0] ==
't' &&
param[0][1] ==
'3') {
2878#ifdef USE_ADDRESS_SANITIZER
2880 int *a = (
int *) malloc(
sizeof(
int) * 10);
2884 printf(
"test address sanitizer is disabled!\n");
2889 else if ((
param[0][0] ==
'e' &&
param[0][1] ==
'x' &&
param[0][2] ==
'i') || (
param[0][0] ==
'q'))
2892 else if (
param[0][0] == 0)
2933int odbedit(
char *ahost_name,
char *aexp_name)
2940 char cmd[2000], dir[256];
2947 cmd[0] = dir[0] = 0;
2960 if (!getenv(
"MIDASSYS")) {
2961 puts(
"Please define environment variable 'MIDASSYS'");
2962 puts(
"pointing to the midas source installation directory.");
2966 for (
i = 1;
i < argc;
i++) {
2967 if (argv[
i][0] ==
'-' && argv[
i][1] ==
'g')
2969 else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'q')
2971 else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'R')
2972 reload_from_file =
TRUE;
2973 else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'C')
2975 else if (argv[
i][0] ==
'-') {
2976 if (
i + 1 >= argc || argv[
i + 1][0] ==
'-')
2978 if (argv[
i][1] ==
'e')
2980 else if (argv[
i][1] ==
'h')
2982 else if (argv[
i][1] ==
'c') {
2983 if (strlen(argv[
i + 1]) >=
sizeof(cmd)) {
2984 printf(
"error: command line too long (>%d bytes)\n", (
int)
sizeof(cmd));
2987 mstrlcpy(cmd, argv[++
i],
sizeof(cmd));
2989 }
else if (argv[
i][1] ==
'd')
2990 mstrlcpy(dir, argv[++
i],
sizeof(dir));
2991 else if (argv[
i][1] ==
's')
2995 printf(
"usage: odbedit [-h Hostname] [-e Experiment] [-d ODB Subtree]\n");
2996 printf(
" [-q] [-c Command] [-c @CommandFile] [-s size]\n");
2997 printf(
" [-g (debug)] [-C (connect to corrupted ODB)]\n");
2998 printf(
" [-R (reload ODB from .ODB.SHM)]\n\n");
2999 printf(
"For a list of valid commands start odbedit interactively\n");
3000 printf(
"and type \"help\".\n");
3008 if (reload_from_file) {
3009#ifdef LOCAL_ROUTINES
3012 printf(
"Cannot setup experiment name and path.\n");
3016 printf(
"MIDAS ODB shared memory was deleted, ss_shm_delete(ODB) status %d\n",
status);
3017 printf(
"Please run odbedit again without \'-R\' and ODB will be reloaded from .ODB.SHM\n");
3020 printf(
"This odbedit only works remotely, -R is not supported\n");
3033 printf(
"Connected to MIDAS server \"%s\" experiment \"%s\"\n",
host_name,
exp_name);
3043 printf(
"ODB is corrupted, connecting anyway...\n");
3076 cm_msg(
MINFO,
"odbedit",
"Execute command from command line: \"%s\"", cmd);
3088 return EXIT_FAILURE;
3090 return EXIT_SUCCESS;
INT al_reset_alarm(const char *alarm_name)
INT bm_open_buffer(const char *buffer_name, INT buffer_size, INT *buffer_handle)
INT bm_close_buffer(INT buffer_handle)
INT cm_shutdown(const char *name, BOOL bUnique)
INT cm_yield(INT millisec)
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
INT cm_connect_client(const char *client_name, HNDLE *hConn)
INT cm_transition(INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
INT cm_connect_experiment1(const char *host_name, const char *default_exp_name, const char *client_name, void(*func)(char *), INT odb_size, DWORD watchdog_timeout)
void cm_ack_ctrlc_pressed()
INT cm_execute(const char *command, char *result, INT bufsize)
INT cm_get_watchdog_info(HNDLE hDB, const char *client_name, DWORD *timeout, DWORD *last)
INT cm_cleanup(const char *client_name, BOOL ignore_timeout)
INT cm_disconnect_experiment(void)
int cm_set_experiment_local(const char *exp_name)
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
const char * cm_get_version()
const char * cm_get_revision()
BOOL cm_is_ctrlc_pressed()
INT cm_set_watchdog_params(BOOL call_watchdog, DWORD timeout)
#define CM_DEFERRED_TRANSITION
#define CM_TRANSITION_IN_PROGRESS
#define CM_WRONG_PASSWORD
#define DB_INVALID_HANDLE
#define DB_NO_MORE_SUBKEYS
INT ss_shm_delete(const char *name)
INT ss_getchar(BOOL reset)
char * ss_getpass(const char *prompt)
std::string ss_tid_to_string(midas_thread_t thread_id)
midas_thread_t ss_gettid(void)
INT ss_sleep(INT millisec)
char * ss_crypt(const char *buf, const char *salt)
char * ss_gets(char *string, int size)
void * ss_ctrlc_handler(void(*func)(int))
INT cm_msg1(INT message_type, const char *filename, INT line, const char *facility, const char *routine, const char *format,...)
INT cm_msg_register(EVENT_HANDLER *func)
INT cm_msg_flush_buffer()
std::string cm_get_error(INT code)
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
INT cm_msg_retrieve(INT n_message, char *message, INT buf_size)
INT cm_set_msg_print(INT system_mask, INT user_mask, int(*func)(const char *))
BOOL equal_ustring(const char *str1, const char *str2)
INT db_sprintfh(char *string, const void *data, INT data_size, INT idx, DWORD type)
INT db_get_data_index(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT idx, DWORD type)
INT db_delete_key(HNDLE hDB, HNDLE hKey, BOOL follow_links)
INT db_find_link(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
INT db_reorder_key(HNDLE hDB, HNDLE hKey, INT idx)
INT db_save_json(HNDLE hDB, HNDLE hKey, const char *filename, int flags)
INT db_open_record(HNDLE hDB, HNDLE hKey, void *ptr, INT rec_size, WORD access_mode, void(*dispatcher)(INT, INT, void *), void *info)
INT db_get_open_records(HNDLE hDB, HNDLE hKey, char *str, INT buf_size, BOOL fix)
INT db_save_xml(HNDLE hDB, HNDLE hKey, const char *filename)
INT db_set_link_data(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
INT db_get_path(HNDLE hDB, HNDLE hKey, char *path, INT buf_size)
INT db_copy(HNDLE hDB, HNDLE hKey, char *buffer, INT *buffer_size, const char *path)
INT db_set_link_data_index(HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type)
std::string db_show_mem(HNDLE hDB, BOOL verbose)
INT db_get_record_size(HNDLE hDB, HNDLE hKey, INT align, INT *buf_size)
INT db_get_data(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
INT db_create_key(HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type)
INT db_copy_json_save(HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
INT db_save_struct(HNDLE hDB, HNDLE hKey, const char *file_name, const char *struct_name, BOOL append)
INT db_unwatch(HNDLE hDB, HNDLE hKey)
INT db_set_mode(HNDLE hDB, HNDLE hKey, WORD mode, BOOL recurse)
INT db_save(HNDLE hDB, HNDLE hKey, const char *filename, BOOL bRemote)
INT db_scan_tree(HNDLE hDB, HNDLE hKey, INT level, INT(*callback)(HNDLE, HNDLE, KEY *, INT, void *), void *info)
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
INT db_get_link(HNDLE hDB, HNDLE hKey, KEY *key)
INT db_load(HNDLE hDB, HNDLE hKeyRoot, const char *filename, BOOL bRemote)
INT EXPRT db_get_value_string(HNDLE hdb, HNDLE hKeyRoot, const char *key_name, int index, std::string *s, BOOL create, int create_string_length)
INT db_set_data_index(HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type)
INT db_save_string(HNDLE hDB, HNDLE hKey, const char *file_name, const char *string_name, BOOL append)
INT db_paste(HNDLE hDB, HNDLE hKeyRoot, const char *buffer)
INT db_watch(HNDLE hDB, HNDLE hKey, void(*dispatcher)(INT, INT, INT, void *), void *info)
INT db_set_data(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
INT db_enum_link(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
INT db_copy_json_ls(HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
INT db_sprintf(char *string, const void *data, INT data_size, INT idx, DWORD type)
void strarrayindex(char *odbpath, int *index1, int *index2)
INT db_copy_json_values(HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end, int omit_names, int omit_last_written, time_t omit_old_timestamp, int preserve_case)
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
INT db_get_link_data(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
INT db_rename_key(HNDLE hDB, HNDLE hKey, const char *name)
INT db_get_key_time(HNDLE hDB, HNDLE hKey, DWORD *delta)
INT db_find_keys(HNDLE hDB, HNDLE hKeyRoot, const char *odbpath, std::vector< HNDLE > &hKeyVector)
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
INT db_close_record(HNDLE hDB, HNDLE hKey)
INT db_sscanf(const char *data_str, void *data, INT *data_size, INT i, DWORD tid)
INT db_set_num_values(HNDLE hDB, HNDLE hKey, INT num_values)
INT db_create_link(HNDLE hDB, HNDLE hKey, const char *link_name, const char *destination)
INT rpc_client_call(HNDLE hConn, DWORD routine_id,...)
const char * rpc_tid_name(INT id)
#define RPC_ANA_CLEAR_HISTOS
char exp_name[NAME_LENGTH]
const char * analyzer_name
BOOL debug
debug printouts
char host_name[HOST_NAME_LENGTH]
std::string msprintf(const char *format,...)
#define DEFAULT_WATCHDOG_TIMEOUT
#define JSFLAG_FOLLOW_LINKS
#define JSFLAG_OMIT_LAST_WRITTEN
#define DEFAULT_BUFFER_SIZE
#define EVENT_BUFFER_NAME
#define message(type, str)
#define write(n, a, f, d)
INT cmd_edit(const char *prompt, char *cmd, INT(*dir)(char *, INT *), INT(*idle)())
void watch_callback(HNDLE hDB, HNDLE hKey, INT index, void *info)
void ctrlc_odbedit(INT i)
void compose_name(char *pwd, char *name, char *full_name)
int print_message(const char *msg)
BOOL check_abort(int flags, int l)
void set_key(HNDLE hDB, HNDLE hKey, int index1, int index2, char *value)
void print_help(char *command)
static void xwrite(const char *filename, int fd, const void *data, int size)
void del_tree(HNDLE hDB, HNDLE hKey, INT level)
INT cmd_dir(char *line, INT *cursor)
void assemble_prompt(char *prompt, int psize, char *host_name, char *exp_name, char *pwd)
INT search_key(HNDLE hDB, HNDLE hKey, KEY *key, INT level, void *info)
static void pad_to_pos(std::string *s, size_t pos)
void process_message(HNDLE hBuf, HNDLE id, EVENT_HEADER *pheader, void *message)
BOOL match(char *pat, char *str)
void create_experim_h(HNDLE hDB, const char *analyzer_name)
int command_loop(char *host_name, char *exp_name, char *cmd, char *start_dir)
void key_update(HNDLE hDB, HNDLE hkey, void *info)
INT print_key(HNDLE hDB, HNDLE hKey, KEY *pkey, INT level, void *info)