Exemplo n.º 1
0
int main(int argc, char *argv[])
{
#ifdef DEBUG
#if 0
    // Erlang on Windows really doesn't like logging to stderr.
    log_location = stderr;
#else
    FILE *fp = fopen("nerves_uart.log", "w+");
    log_location = fp;

    debug("Starting...");
#endif
#endif

    if (argc == 1)
        main_loop();
    else if (argc == 2 && strcmp(argv[1], "enumerate") == 0)
        enumerate_ports();
#ifdef DEBUG
    else if (argc == 2 && strcmp(argv[1], "test") == 0)
        test();
#endif
    else
        errx(EXIT_FAILURE, "%s [enumerate]", argv[0]);

    return 0;
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
#ifdef DEBUG
#if 0
    // Erlang on Windows really doesn't like logging to stderr.
    log_location = stderr;
#else
    char logfile[64];
#ifdef __WIN32__
    sprintf(logfile, "circuits_uart-%d.log", (int) GetCurrentProcessId());
#else
    sprintf(logfile, "/tmp/circuits_uart-%d.log", (int) getpid());
#endif
    FILE *fp = fopen(logfile, "w+");
    log_location = fp;

    debug("Starting...");
#endif
#endif

    if (argc == 1)
        main_loop();
    else if (argc == 2 && strcmp(argv[1], "enumerate") == 0)
        enumerate_ports();
#ifdef DEBUG
    else if (argc == 2 && strcmp(argv[1], "test") == 0)
        test();
#endif
    else
        errx(EXIT_FAILURE, "%s [enumerate]", argv[0]);

    return 0;
}