summaryrefslogtreecommitdiffstats
path: root/contrib/syslinux-4.02/com32/lib/sys/screensize.c
blob: 340227cdbd7d76c239b1a45de34270b865527430 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <unistd.h>
#include <errno.h>
#include "file.h"

int getscreensize(int fd, int *rows, int *cols)
{
    struct file_info *fp = &__file_info[fd];

    if (fd >= NFILES || !fp->iop) {
	errno = EBADF;
	return -1;
    }

    *rows = fp->o.rows;
    *cols = fp->o.cols;

    if (!rows || !cols) {
	errno = ENOTTY;
	return -1;
    }

    return 0;
}