diff options
Diffstat (limited to 'fbset.c')
-rw-r--r-- | fbset.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -33,8 +33,6 @@ | |||
33 | #include <ctype.h> | 33 | #include <ctype.h> |
34 | #include <sys/ioctl.h> | 34 | #include <sys/ioctl.h> |
35 | 35 | ||
36 | #define PERROR(ctx) do { perror(ctx); exit(1); } while(0) | ||
37 | |||
38 | #define DEFAULTFBDEV "/dev/fb0" | 36 | #define DEFAULTFBDEV "/dev/fb0" |
39 | #define DEFAULTFBMODE "/etc/fb.modes" | 37 | #define DEFAULTFBMODE "/etc/fb.modes" |
40 | 38 | ||
@@ -198,7 +196,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, | |||
198 | char *p = buf; | 196 | char *p = buf; |
199 | 197 | ||
200 | if ((f = fopen(fn, "r")) == NULL) | 198 | if ((f = fopen(fn, "r")) == NULL) |
201 | PERROR("readmode(fopen)"); | 199 | perror_msg_and_die("readmode(fopen)"); |
202 | while (!feof(f)) { | 200 | while (!feof(f)) { |
203 | fgets(buf, sizeof(buf), f); | 201 | fgets(buf, sizeof(buf), f); |
204 | if ((p = strstr(buf, "mode ")) || (p = strstr(buf, "mode\t"))) { | 202 | if ((p = strstr(buf, "mode ")) || (p = strstr(buf, "mode\t"))) { |
@@ -428,9 +426,9 @@ extern int fbset_main(int argc, char **argv) | |||
428 | } | 426 | } |
429 | 427 | ||
430 | if ((fh = open(fbdev, O_RDONLY)) < 0) | 428 | if ((fh = open(fbdev, O_RDONLY)) < 0) |
431 | PERROR("fbset(open)"); | 429 | perror_msg_and_die("fbset(open)"); |
432 | if (ioctl(fh, FBIOGET_VSCREENINFO, &var)) | 430 | if (ioctl(fh, FBIOGET_VSCREENINFO, &var)) |
433 | PERROR("fbset(ioctl)"); | 431 | perror_msg_and_die("fbset(ioctl)"); |
434 | if (g_options & OPT_READMODE) { | 432 | if (g_options & OPT_READMODE) { |
435 | if (!readmode(&var, modefile, mode)) { | 433 | if (!readmode(&var, modefile, mode)) { |
436 | error_msg("Unknown video mode `%s'\n", mode); | 434 | error_msg("Unknown video mode `%s'\n", mode); |
@@ -441,7 +439,7 @@ extern int fbset_main(int argc, char **argv) | |||
441 | setmode(&var, &varset); | 439 | setmode(&var, &varset); |
442 | if (g_options & OPT_CHANGE) | 440 | if (g_options & OPT_CHANGE) |
443 | if (ioctl(fh, FBIOPUT_VSCREENINFO, &var)) | 441 | if (ioctl(fh, FBIOPUT_VSCREENINFO, &var)) |
444 | PERROR("fbset(ioctl)"); | 442 | perror_msg_and_die("fbset(ioctl)"); |
445 | showmode(&var); | 443 | showmode(&var); |
446 | /* Don't close the file, as exiting will take care of that */ | 444 | /* Don't close the file, as exiting will take care of that */ |
447 | /* close(fh); */ | 445 | /* close(fh); */ |