core: remove reference to a non-existing field of the theme struct
[fbsplash.git] / misc / fbres.c
blob37cb9a82aa52037b1e10348e3f27a017cb57c2fd
1 /*
2 * A stupid little program that isn't really useful for anything
3 * and that has to be here because some people use separate /usr
4 * partitions.
6 */
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <stdarg.h>
11 #include <unistd.h>
12 #include <string.h>
13 #include <fcntl.h>
14 #include <errno.h>
15 #include <sys/ioctl.h>
16 #include <ctype.h>
17 #include <sys/stat.h>
18 #include <linux/fb.h>
20 void die(const char *fmt, ...)
22 va_list ap;
24 fflush(stdout);
25 va_start(ap, fmt);
26 vfprintf(stderr, fmt, ap);
27 va_end(ap);
28 exit(1);
31 int main(int argc, char *argv[])
33 struct fb_var_screeninfo var;
34 int fh;
35 char *xres, *yres;
37 xres = getenv("SPLASH_XRES");
38 yres = getenv("SPLASH_YRES");
40 if (xres && yres && atoi(xres) > 0 && atoi(yres) > 0) {
41 printf("%sx%s\n", xres, yres);
42 return 0;
45 if ((fh = open("/dev/fb0", O_RDONLY)) == -1)
46 if ((fh = open("/dev/fb/0", O_RDONLY)) == -1)
47 die("Can't open /dev/fb0 or /dev/fb/0\n");
49 if (ioctl(fh, FBIOGET_VSCREENINFO, &var))
50 die("Can't get fb_var\n");
53 printf("%dx%d\n", var.xres, var.yres);
54 close(fh);
56 return 0;