Пример #1
0
void
advance(void)
{
  token = token->next;
  if (token == nil) {
    token = readtokens();
  }
}
Пример #2
0
void
setupinputfd(int nfd)
{
  fd = nfd;
  max = offset = 0;
  s = base;

  token = readtokens();
}
Пример #3
0
void
setupinputstring(char *str, size_t len)
{
  fd = ERR;

  max = len;
  offset = 0;
  s = base;

  memmove(base, str, len);

  token = readtokens();
}
Пример #4
0
char *test_readtokens() {
	char **toks = makeStringArray(5, 10);
	char line[15] = "123,45678,0000";
	int count = readtokens(toks, line, ',');

	mu_assert("read token: count wrong", count == 3);
	mu_assert("read token: pos 0 wrong", strcmp(toks[0], "123") == 0);
	mu_assert("read token: pos 1 wrong", strcmp(toks[1], "45678") == 0);
	mu_assert("read token: pos 2 wrong", strcmp(toks[2], "0000") == 0);

	freeStringArray(toks, 5);

	return 0;
}
Пример #5
0
int
main(int argc, char **argv)
{
    int n = readtokens();
    runalltest(ctmaintest, n);
    writetokens(n);
    int code = report(ctmaintest);
    if (code != 0) {
        return code;
    }
    if (argc == 2 && strcmp(argv[1], "-b") == 0) {
        runallbench(ctmainbench);
    }
    return 0;
}