예제 #1
0
/*
 * main.c
 */
int main(void) {
    WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer
	
    // !! See select.h !!
#ifdef RUN_BLINK
    blink_main();
#endif
#ifdef RUN_TIMERS
    timers_main();
#endif
#ifdef RUN_PWM
    pwm_main();
#endif
#ifdef RUN_FLASH
    flash_main();
#endif
#ifdef RUN_UART
    uart_main();
#endif
#ifdef RUN_SOUND_METER
    sound_meter_main();
#endif
#ifdef RUN_CLOCK
    clock_main();
#endif
#ifdef RUN_SLOTS
    slots_main();
#endif

	return 0;
}
예제 #2
0
파일: nclock.c 프로젝트: FliPPeh/NClock
int main(int argc, char **argv)
{
    int c;
    int clock_color = COLOR_CYAN;
    int border = 0;
    int tmp;
    int tfh = 0;
    int random = 0;
    int use_strftime = 0;
    char format[512] = {0};

    for (;;)
    {
        if ((c = getopt(argc, argv, "b:c:hvdr:f:")) != -1)
        {
            switch (c)
            {
                case 'v': /* Version */
                    printf("%s version 1.0\n", "nclock");
                    return EXIT_SUCCESS;

                case 'h':
                    show_help();
                    return EXIT_SUCCESS;

                case 'b':
                    border = *optarg;

                    break;

                case 'd':
                    tfh = 1;
                    break;
                case 'r':
                    random = strtod(optarg, NULL);

                    break;

                case 'f':
                    strncpy(format, optarg, sizeof(format) - 1);
                    use_strftime = 1;

                    break;

                case 'c':
                    tmp = strtod(optarg, NULL);

                    if ((tmp <= 8) && (tmp >= 0))
                        clock_color = tmp;
                    else
                        fprintf(stderr, "bad color value -- resorting to "
                                        "default\n");

                    break;

                case '?':
                    return EXIT_FAILURE;
            }
        }
        else
            break;
    }

    signal(SIGINT, finish);

    initscr();
    noecho();
    cbreak();

    start_color();
    use_default_colors();

    clock_main(border, tfh, random, clock_color, use_strftime ? format : NULL);

    return EXIT_SUCCESS;
}