1141{
1149 int restart_count = 0;
1150
1151
1153
1154
1156
1157
1159
1160
1161 for (
i = 1;
i < argc;
i++) {
1162 if (argv[
i][0] ==
'-' && argv[
i][1] ==
'd')
1164 else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'D')
1166 else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'w')
1168 else if (argv[
i][0] ==
'-') {
1169 if (
i + 1 >= argc || argv[
i + 1][0] ==
'-')
1171 if (strncmp(argv[
i],
"-e", 2) == 0)
1173 else if (strncmp(argv[
i],
"-h", 2) == 0)
1175 else if (strncmp(argv[
i],
"-b", 2) == 0)
1177 } else {
1179 printf("usage: mevb [-h <Hostname>] [-e <Experiment>] [-b <buffername>] [-d] [-w] [-D]\n");
1180 printf(" [-h <Hostname>] Host where midas experiment is running on\n");
1181 printf(" [-e <Experiment>] Midas experiment if more than one exists\n");
1182 printf(" [-b <buffername>] Specify evnet buffer name, use \"SYSTEM\" by default\n");
1183 printf(" [-d] Print debugging output\n");
1184 printf(" [-w] Show wheel\n");
1185 printf(" [-D] Start as a daemon\n");
1186 return 0;
1187 }
1188 }
1189
1190 printf("MIDAS example event builder. Press \"!\" to exit.\n");
1191
1193 printf("Becoming a daemon...\n");
1195 }
1196
1197
1201 goto exit;
1202 }
1203
1206
1207
1211 goto exit;
1212 }
1213
1214
1219 goto exit;
1220 }
1221
1222
1223 size = sizeof(rstate);
1226 cm_msg(
MERROR,
"main",
"Run in Progress, EBuilder aborted!.");
1228 goto exit;
1229 }
1230
1233
1235 goto exit;
1236 }
1237
1238
1242 goto exit;
1243 }
1244
1245
1249 goto exit;
1250 }
1251
1252
1258 goto exit;
1260 goto exit;
1261
1262 restart:
1263
1264
1268 }
1269
1271 {
1276
1278
1280 }
1281
1282
1284
1285
1288
1289
1292
1294
1297
1299
1301 {
1302 restart_count ++;
1303 goto restart;
1304 }
1305
1306
1308
1309 exit:
1310
1312
1313
1315 return 0;
1316}
INT cm_register_transition(INT transition, INT(*func)(INT, char *), INT sequence_number)
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
INT cm_transition(INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
INT cm_disconnect_experiment(void)
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
INT cm_set_watchdog_params(BOOL call_watchdog, DWORD timeout)
INT cm_exist(const char *name, BOOL bUnique)
INT ss_getchar(BOOL reset)
INT ss_daemon_init(BOOL keep_stdout)
INT ss_sleep(INT millisec)
std::string strcomb1(const char **list)
INT db_create_record(HNDLE hDB, HNDLE hKey, const char *orig_key_name, const char *init_str)
void free_event_buffer(INT nfrag)
INT tr_stop(INT rn, char *error)
INT tr_start(INT rn, char *error)
char expt_name[NAME_LENGTH]
INT tr_pause(INT rn, char *error)
INT register_equipment(void)
INT tr_resume(INT rn, char *error)
char host_name[HOST_NAME_LENGTH]