Exemplo n.º 1
0
static void
on_child_exit(int signum, siginfo_t *siginfo, void *arg)
{
	int status;

	/*
  	 * if srun_cr is checkpoint/restart-ed after srun exited,
  	 * srun_pid will be the pid of the new srun.
	 */
	cr_enter_cs(cr_id);
	if (waitpid(srun_pid, &status, WNOHANG) == srun_pid) {
		verbose("srun(%d) exited, status: %d", srun_pid, status);
		mimic_exit(status);
	}
	kill(srun_pid, SIGKILL);
	cr_leave_cs(cr_id);
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
    cst_voice *v;
    char thetime[1024];
    char b[3];
    int hour, min;
    cst_regex *timex;
    char *output = "play";

    if (argc != 2)
    {
        fprintf(stderr, "usage: mimic_time HH:MM\n");
        exit(-1);
    }
    timex = new_cst_regex("[012][0-9]:[0-5][0-9]");
    if (!cst_regex_match(timex, argv[1]))
    {
        fprintf(stderr, "not a valid time\n");
        fprintf(stderr, "usage: mimic_time HH:MM\n");
        exit(-1);
    }
    delete_cst_regex(timex);
    b[2] = '\0';
    b[0] = argv[1][0];
    b[1] = argv[1][1];
    hour = atoi(b);
    b[0] = argv[1][3];
    b[1] = argv[1][4];
    min = atoi(b);

    mimic_init();

    v = register_cmu_time_awb(NULL);

    sprintf(thetime,
            "The time is now, %s %s %s, %s.",
            time_approx(hour, min), time_min(hour, min), time_hour(hour, min),
            time_tod(hour, min));

    printf("%s\n", thetime);
    mimic_text_to_speech(thetime, v, output);

    mimic_exit();

    return 0;
}