Support FreeBSD framebuffer

Origin: http://www.ac.auone-net.jp/~baba/w3m-img/index.html
Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=122673
This commit is contained in:
Yusuke Baba
2014-12-03 22:29:39 +09:00
committed by Tatsuya Kinoshita
parent eeea7ba4fe
commit 416d70d11e
4 changed files with 435 additions and 6 deletions

View File

@@ -153,10 +153,15 @@ check_tty_console(char *tty)
return 0;
if (strncmp(tty, "/dev/", 5) == 0)
tty += 5;
#if defined(__linux__)
if (strncmp(tty, "tty", 3) == 0 && isdigit(*(tty + 3)))
return 1;
if (strncmp(tty, "vc/", 3) == 0 && isdigit(*(tty + 3)))
return 1;
#elif defined(__FreeBSD__)
if (strncmp(tty, "ttyv", 4) == 0 && isxdigit(*(tty + 4)))
return 1;
#endif
return 0;
}
#else
@@ -172,7 +177,9 @@ w3mimg_fbopen()
return NULL;
memset(wop, 0, sizeof(w3mimg_op));
if (!check_tty_console(getenv("W3M_TTY")) && strcmp("jfbterm", getenv("TERM")) != 0) {
if (!check_tty_console(getenv("W3M_TTY")) &&
strcmp("jfbterm", getenv("TERM")) != 0 &&
strncmp("jfbterm-", getenv("TERM"), 8) != 0) {
fprintf(stderr, "w3mimgdisplay/fb: tty is not console\n");
goto error;
}