330{
331 char command[512];
334
337 char eqpstr[128] = {
'\0' };
345
349
350
351 if (
getenv(
"MCHART_DIR")) {
355 }
356
357
358 for (
int i = 1;
i <
argc;
i++) {
361 else if (
argv[
i][0] ==
'-' &&
argv[
i][1] ==
'c')
363 else if (
argv[
i][0] ==
'-' &&
argv[
i][1] ==
's')
369 else if (
argv[
i][0] ==
'-' &&
argv[
i][1] ==
'g')
371 else if (
argv[
i][0] ==
'-' &&
argv[
i][1] ==
'k')
373 else if (
argv[
i][0] ==
'-' &&
argv[
i][1] ==
'D')
375 else if (
argv[
i][0] ==
'-') {
393 if (
argv[++
i][0] !=
'/')
401 } else {
403 printf(
"usage: mchart -u updates (5sec)\n");
404 printf(
" -f configuration or data file name\n");
405 printf(
" -q equipment\n");
406 printf(
" (override all) -b bot_limit -t top_limit (only with -q) \n");
407 printf(
" -c create config only \n");
408 printf(
" -k keep spawned stripchart or gstripchart\n");
410 (" -g spawn Hofman stripchart or gstripchart if possible\n");
411 printf(
" -gg forces gstripchart spawning\n");
412 printf(
" -gh forces stripchart spawning\n");
413 printf(
" -D start as daemon (prevented if -c or -q)\n");
414 printf(
" requires $MCHART_DIR\n");
415 printf(
" [-h Hostname] [-e Experiment]\n\n");
416 printf(
"ex: Creation : mchart -e myexpt -h myhost -c \n");
417 printf(
" -f mydata -q /equipement/myeqp/variables\n");
418 printf(
" Running : mchart -e myexpt -h myhost -f mydata \n");
419 printf(
" Run/Graph : mchart -e myexpt -h myhost -f mydata -g\n");
420 printf(
" MCHART_DIR: environment variable for mchar directory\n\n");
421 return 0;
422 }
423 }
424
425
427 printf(
"Becoming a daemon...\n");
429 }
430
432 printf(
"arg -D ignored due to creation request! \n");
433
434
437 return 1;
438
441
442
444
445
447
448
450
451
453 for (
int i = 2;
i <
argc;
i++) {
456 }
457
458
460
464 char *s;
465
468
472 goto error;
473 }
477 goto error;
478 }
482 }
486 } else {
487
488
489
491 printf(
"unknown odb path under -q arg. (%s)\n",
eqpstr);
492 goto error;
493 }
496 goto error;
497 }
498
499 do {
504 goto error;
508 }
509 }
510
511
513 char command[512];
516
517 char strip[][32] = {
"/usr/local/bin",
"stripchart",
518 "/usr/bin", "gstripchart",
519 "/home/midas/bin", "stripchart",
520 "/usr/sbin", "gstripchart",
521 "/home/chaos/bin", "stripchart",
522 "/sbin", "gstripchart",
523 ""
524 };
525
531 break;
533 }
535 printf(
"No graphic package found in following dir:\n");
540 }
541 break;
542 }
545 else
547
549 printf(
"Spawning graph with %s ...\nUse '!' to exit\n", command);
551 }
else if (
graph == 2) {
554 printf(
"Spawning graph with %s ...\nUse '!' to exit\n", command);
556 }
else if (
graph == 3) {
560 printf(
"Spawning graph with %s ...in DEBUG mode \nUse '!' to exit\n",
561 command);
565 return 1;
566
567 } else {
570 printf(
"Spawning graph with %s .... \nUse '!' to exit\n", command);
572 }
573
574 }
575
584 if ((
char)
ch ==
'!')
585 break;
586 }
588
589
591 break;
592
594
596 error:
598
599
601
603 return 1;
604}
INT cm_yield(INT millisec)
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_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 ss_getchar(BOOL reset)
INT ss_daemon_init(BOOL keep_stdout)
INT ss_exec(const char *command, INT *pid)
BOOL ss_existpid(INT pid)
INT ss_file_find(const char *path, const char *pattern, char **plist)
INT cm_set_msg_print(INT system_mask, INT user_mask, int(*func)(const char *))
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
char host_name[HOST_NAME_LENGTH]
INT conf_compose(INT action, char *confpath, char *datapath, char *field, float val)
BOOL debug
debug printouts
INT mchart_compose(HNDLE hDB, char *confpath, char *datapath, char *eqpstr)
char expt_name[NAME_LENGTH]
#define DIR_SEPARATOR_STR
static te_expr * list(state *s)