int check_seeking(size_t *errs)
{
	struct seeko so;
	int ret = 0;

	/* First opening. */
	if(open_file() != 0) return -1;

	printf("Collecting samples...\n");
	ret = collect(&so);
	if(ret != 0) return ret;

	errs[0] = check_positions(&so);

	printf("With fresh opening (empty seek index):\n");
	if(open_file() != 0) return -1;

	errs[1] = check_positions(&so);

	printf("Another fresh Opening to see if first sample works:\n");
	if(open_file() != 0) return -1;
	if(check_sample(&so, 0) != 0)
	++first_sample_errs;

	return ret;
}
Beispiel #2
0
void clear(void) {
	for (unsigned int i = 0; i < SCREENSIZE; i++) {
		vidptr[i++] = ' ';
		vidptr[i] = BASE_COLOR;
	}
	current_loc = 0;
	check_positions();
}
Beispiel #3
0
void print_char_colored(char c, char color) {
	if (c == '\n') {
		println_newline();
	}else if (c == '\b') {
		if (current_loc <= 0) {
			current_loc = 0;
			return;
		}
		current_loc--;
		vidptr[current_loc--] = BASE_COLOR;
		vidptr[current_loc] = ' ';
	}else{
		vidptr[current_loc++] = c;
		vidptr[current_loc++] = color;
	}
	check_positions();
}
Beispiel #4
0
void println_newline() {
	unsigned int line_size = BYTES * COLUMNS;
	current_loc += line_size - current_loc % line_size;
	check_positions();
}