/* @rows: pointer to return number of rows @cols: pointer to return number of columns Returns: 0 on success  */
static int query_console_serial(int *rows, int *cols)
/* @rows: pointer to return number of rows @cols: pointer to return number of columns Returns: 0 on success  */
static int query_console_serial(int *rows, int *cols)
{
	int ret = 0;
	int n[2];
	while (tstc())
		getc();
	printf(ESC "7"
	       ESC "[r"
	       ESC "[999;999H"
	       ESC "[6n");
	if (term_read_reply(n, 2, 'R')) {
		ret = 1;
		goto out;
	}
	*cols = n[1];
	*rows = n[0];
out:
	printf(ESC "8");
	return ret;
}