void rs232_tick() {
  char line[30];
  if (RingBufferDmaU8_readLine(&rs232RxRing, line, sizeof(line)) > 0) {
    strTrimRight(line);
    if (strlen(line) > 0) {
      rs232_processLine(line);
    }
  }
}
Exemple #2
0
END_TEST

START_TEST(test_strTrimRight)
{
    char *string;

    string = strCreate();
    strCopy(string, " \n\r\tfoobar");
    strTrimRight(string);
    fail_unless(strEquals(string, " \n\r\tfoobar"), NULL);
    strCopy(string, "foobar \n\r\t");
    strTrimRight(string);
    fail_unless(strEquals(string, "foobar"), NULL);
    strCopy(string, "foobar");
    strTrimRight(string);
    fail_unless(strEquals(string, "foobar"), NULL);
    strCopy(string, " \n\r\tfoobar \r\t\n");
    strTrimRight(string);
    fail_unless(strEquals(string, " \n\r\tfoobar"), NULL);
    strCopy(string, " \n\r\tfoo\t \n\rbar \r\t\n");
    strTrimRight(string);
    fail_unless(strEquals(string, " \n\r\tfoo\t \n\rbar"), NULL);
}
Exemple #3
0
bool VoxMain::setupLog()
{
    if(m_logdir.empty())
    {
        if(m_debug)
            Trace::getInstance().open("/dev/stdout", (Trace::TraceLevel)m_loglevel);
    }
    else
    {
        std::string logpath = strTrimRight(m_logdir, "/") + "/vox.log";
        Trace::getInstance().open(logpath, (Trace::TraceLevel)m_loglevel);
    }

    setlinebuf(stdout);

    return true;
}