summary refs log tree commit diff
path: root/bin/gfx/fb.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/gfx/fb.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/bin/gfx/fb.c b/bin/gfx/fb.c
index 94a3245e..7ee5fea1 100644
--- a/bin/gfx/fb.c
+++ b/bin/gfx/fb.c
@@ -32,56 +32,56 @@
 
 static struct termios saveTerm;
 static void restoreTerm(void) {
-    tcsetattr(STDERR_FILENO, TCSADRAIN, &saveTerm);
+	tcsetattr(STDERR_FILENO, TCSADRAIN, &saveTerm);
 }
 
 int main(int argc, char *argv[]) {
-    int error;
+	int error;
 
-    error = init(argc, argv);
-    if (error) return error;
+	error = init(argc, argv);
+	if (error) return error;
 
-    const char *path = getenv("FRAMEBUFFER");
-    if (!path) path = "/dev/fb0";
+	const char *path = getenv("FRAMEBUFFER");
+	if (!path) path = "/dev/fb0";
 
-    int fb = open(path, O_RDWR);
-    if (fb < 0) err(EX_OSFILE, "%s", path);
+	int fb = open(path, O_RDWR);
+	if (fb < 0) err(EX_OSFILE, "%s", path);
 
-    struct fb_var_screeninfo info;
-    error = ioctl(fb, FBIOGET_VSCREENINFO, &info);
-    if (error) err(EX_IOERR, "%s", path);
+	struct fb_var_screeninfo info;
+	error = ioctl(fb, FBIOGET_VSCREENINFO, &info);
+	if (error) err(EX_IOERR, "%s", path);
 
-    size_t size = 4 * info.xres * info.yres;
-    uint32_t *buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0);
-    if (buf == MAP_FAILED) err(EX_IOERR, "%s", path);
+	size_t size = 4 * info.xres * info.yres;
+	uint32_t *buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0);
+	if (buf == MAP_FAILED) err(EX_IOERR, "%s", path);
 
-    error = tcgetattr(STDERR_FILENO, &saveTerm);
-    if (error) err(EX_IOERR, "tcgetattr");
-    atexit(restoreTerm);
+	error = tcgetattr(STDERR_FILENO, &saveTerm);
+	if (error) err(EX_IOERR, "tcgetattr");
+	atexit(restoreTerm);
 
-    struct termios term = saveTerm;
-    term.c_lflag &= ~(ICANON | ECHO);
-    error = tcsetattr(STDERR_FILENO, TCSADRAIN, &term);
-    if (error) err(EX_IOERR, "tcsetattr");
+	struct termios term = saveTerm;
+	term.c_lflag &= ~(ICANON | ECHO);
+	error = tcsetattr(STDERR_FILENO, TCSADRAIN, &term);
+	if (error) err(EX_IOERR, "tcsetattr");
 
-    uint32_t saveBg = buf[0];
+	uint32_t saveBg = buf[0];
 
-    uint32_t back[info.xres * info.yres];
-    for (;;) {
-        draw(back, info.xres, info.yres);
-        memcpy(buf, back, size);
+	uint32_t back[info.xres * info.yres];
+	for (;;) {
+		draw(back, info.xres, info.yres);
+		memcpy(buf, back, size);
 
-        char in;
-        ssize_t len = read(STDERR_FILENO, &in, 1);
-        if (len < 0) err(EX_IOERR, "read");
-        if (!len) return EX_DATAERR;
+		char in;
+		ssize_t len = read(STDERR_FILENO, &in, 1);
+		if (len < 0) err(EX_IOERR, "read");
+		if (!len) return EX_DATAERR;
 
-        if (!input(in)) {
-            for (uint32_t i = 0; i < info.xres * info.yres; ++i) {
-                buf[i] = saveBg;
-            }
-            fprintf(stderr, "%s\n", status());
-            return EX_OK;
-        }
-    }
+		if (!input(in)) {
+			for (uint32_t i = 0; i < info.xres * info.yres; ++i) {
+				buf[i] = saveBg;
+			}
+			fprintf(stderr, "%s\n", status());
+			return EX_OK;
+		}
+	}
 }