/*
* Program entry point
*
* Copyright (C) 2019 Patrick McDermott
*
* This file is part of Timeteller.
*
* Timeteller is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Timeteller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Timeteller. If not, see .
*/
#include
#include
#include
#include
#include "screen.h"
#include "speech.h"
static const char *program_name;
static void
set_program_name(const char *name)
{
assert(name && *name);
program_name = name;
}
static void
error(const char *format, ...)
{
va_list ap;
assert(format);
fprintf(stderr, "%s: Error: ", program_name);
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
fputs("\n", stderr);
}
int
main(int argc, char **argv)
{
struct speech *speech;
struct screen *screen;
set_program_name(argv[0]);
speech = speech_new();
if (speech == NULL) {
error("Failed to initialize speech synthesis engine");
return EXIT_FAILURE;
}
screen = screen_new();
speech_play_time(speech);
screen_destroy(&screen);
speech_destroy(&speech);
return EXIT_SUCCESS;
}