- Update to 0.5.3.20170102.

- Switch to code maintained by the Debian Project.
- This version fixes multiple vulnerabilities.
- Add LICENSE.
- Add NLS option.
- Change default Japanese character encoding to UTF-8.

PR:		215822
Reported by:	Daniel <d.stoye@cms.hu-berlin.de>
MFH:		2017Q1
Security:	http://www.vuxml.org/freebsd/eafa3aec-211b-4dd4-9b8a-a664a3f0917a.html
This commit is contained in:
MANTANI Nobutaka 2017-01-09 07:48:30 +00:00
parent 2c3415a951
commit b510f57b66
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=430919
11 changed files with 100 additions and 907 deletions

View file

@ -2,18 +2,26 @@
# $FreeBSD$
PORTNAME= w3m
PORTVERSION= 0.5.3
PORTREVISION= 6
PORTVERSION= 0.5.3.20170102
CATEGORIES+= www ipv6
MASTER_SITES= SF/w3m/w3m/w3m-${PORTVERSION}
MAINTAINER?= nobutaka@FreeBSD.org
COMMENT?= Pager/text-based WWW browser
USES= pkgconfig perl5
USE_OPENSSL= yes
LICENSE= w3m
LICENSE_NAME= w3m
LICENSE_FILE= ${WRKSRC}/doc/README
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
LIB_DEPENDS= libgc.so:devel/boehm-gc
USES= iconv pkgconfig perl5 ssl
USE_GITHUB= yes
GH_ACCOUNT= tats
GH_PROJECT= w3m
GH_TAGNAME= 1ac245b
MAKE_JOBS_UNSAFE= yes
CONFLICTS?= ja-w3m-0.5.* ja-w3m-img-0.5.* w3m-img-0.5.*
@ -22,28 +30,34 @@ CONFIGURE_ARGS= --with-gc=${LOCALBASE} \
ac_cv_path_PERL=${PERL}
CONFIGURE_ENV= DEFS="-I${LOCALBASE}/include"
DOCS= FAQ.html HISTORY MANUAL.html README \
README.dict README.func README.img README.m17n STORY.html \
DOCS_COMMON= FAQ.html HISTORY MANUAL.html README README.cookie \
README.cygwin README.dict README.func README.img \
README.m17n README.mouse README.passwd README.pre_form \
README.siteconf README.tab STORY.html \
keymap.default keymap.lynx menu.default menu.submenu
DOCS_JP= ${DOCS} README.SSL README.cookie README.keymap README.img \
DOCS_DE= FAQ.html MANUAL.html README.func
DOCS_EN= README.sixel
DOCS_JP= ${DOCS_COMMON} README.SSL README.keymap \
README.mailcap README.menu README.migemo
OPTIONS_DEFINE= JAPANESE INLINE_IMAGE KEY_LYNX DOCS
JAPANESE_DESC= Japanese messages and migemo support
OPTIONS_DEFINE= INLINE_IMAGE JAPANESE KEY_LYNX DOCS NLS
INLINE_IMAGE_DESC= Inline image support
JAPANESE_DESC= Japanese messages and migemo support
KEY_LYNX_DESC= Keymap like lynx browser
OPTIONS_SUB= yes
JAPANESE_USES= gettext
JAPANESE_CONFIGURE_ON= --enable-japanese=E --with-migemo=yes gt_cv_func_gnugettext1_libintl=yes
JAPANESE_CONFIGURE_ENABLE= nls
INLINE_IMAGE_USE= gnome=gtk20
INLINE_IMAGE_USE= xorg=x11 gnome=gtk20,gdkpixbuf2
INLINE_IMAGE_CONFIGURE_ON= --with-imagelib=gtk2 --enable-image=fb,x11
INLINE_IMAGE_CONFIGURE_OFF= --enable-image=no
JAPANESE_CONFIGURE_ON= --enable-japanese=U --with-migemo=yes
KEY_LYNX_CONFIGURE_ON= --with-keymap=lynx
NLS_USES= gettext
NLS_CONFIGURE_ON= --enable-nls
NLS_CONFIGURE_OFF= --disable-nls
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MINLINE_IMAGE}
@ -61,6 +75,16 @@ post-patch:
${WRKSRC}/configure
@${FIND} ${WRKSRC}/doc* -type f \! -name HISTORY \
-exec ${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' {} +
@${CP} ${WRKSRC}/doc-jp/README.func ${WRKSRC}/README.func.bak
@${ICONV_CMD} -f EUC-JP -t UTF-8 ${WRKSRC}/README.func.bak \
> ${WRKSRC}/doc-jp/README.func
@${CP} ${WRKSRC}/scripts/w3mhelp-funcdesc.ja.pl.in \
${WRKSRC}/scripts/w3mhelp-funcdesc.ja.pl.in.bak
@${ICONV_CMD} -f EUC-JP -t UTF-8 \
${WRKSRC}/scripts/w3mhelp-funcdesc.ja.pl.in.bak \
> ${WRKSRC}/scripts/w3mhelp-funcdesc.ja.pl.in
@${REINPLACE_CMD} -e 's|EUC-JP|UTF-8|g' \
${WRKSRC}/scripts/w3mhelp-funcdesc.ja.pl.in
post-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/share/doc/ja/w3m
@ -68,11 +92,16 @@ post-install:
for i in ${DOCS_JP} ; do \
${INSTALL_DATA} $$i ${STAGEDIR}${PREFIX}/share/doc/ja/w3m/ ; \
done
@${MKDIR} ${STAGEDIR}${PREFIX}/share/doc/de/w3m
@cd ${WRKSRC}/doc-de; \
for i in ${DOCS_DE} ; do \
${INSTALL_DATA} $$i ${STAGEDIR}${PREFIX}/share/doc/de/w3m/ ; \
done
@cd ${WRKSRC}/doc; \
${MKDIR} ${STAGEDIR}${PREFIX}/share/doc/w3m/; \
for i in ${DOCS} ; do \
for i in ${DOCS_COMMON} ${DOCS_EN} ; do \
${INSTALL_DATA} $$i ${STAGEDIR}${PREFIX}/share/doc/w3m/ ; \
done
@${INSTALL_MAN} ${WRKSRC}/scripts/w3mman/w3mman.1 ${STAGEDIR}${PREFIX}/man/ja/man1
${INSTALL_MAN} ${WRKSRC}/scripts/w3mman/w3mman.1 ${STAGEDIR}${PREFIX}/man/ja/man1
.include <bsd.port.mk>

View file

@ -1,4 +1,3 @@
SHA256 (w3m-0.5.3.tar.gz) = e994d263f2fd2c22febfbe45103526e00145a7674a0fda79c822b97c2770a9e3
SIZE (w3m-0.5.3.tar.gz) = 2202328
SHA256 (w3m-0.5-version-xhtml.patch) = 3cc144a233f566a4b718eec480f3008bb67b8155ecf10663bb98b0aa47a33796
SIZE (w3m-0.5-version-xhtml.patch) = 8965
TIMESTAMP = 1483884967
SHA256 (tats-w3m-0.5.3.20170102-1ac245b_GH0.tar.gz) = 77b1fc96baeea6ae713dd029cf86b5b4711b4fe1a93487a280ef5cf913b77a18
SIZE (tats-w3m-0.5.3.20170102-1ac245b_GH0.tar.gz) = 2180133

View file

@ -1,11 +0,0 @@
--- config.h.in.orig 2011-01-04 18:22:19.000000000 +0900
+++ config.h.in 2014-08-03 20:27:06.000000000 +0900
@@ -84,7 +84,7 @@
#undef INET6
#undef HAVE_SOCKLEN_T
#undef HAVE_OLD_SS_FAMILY
-#define USE_EGD
+#undef USE_EGD
#define ENABLE_REMOVE_TRAILINGSPACES
#undef MENU_THIN_FRAME
#undef USE_RAW_SCROLL

View file

@ -1,19 +0,0 @@
--- configure.orig 2011-01-15 12:04:22.000000000 +0900
+++ configure 2016-01-16 22:01:18.489330000 +0900
@@ -6755,7 +6755,7 @@
if test x"$enable_image" = xyes; then
enable_image=x11
case "`uname -s`" in
- Linux|linux|LINUX)
+ Linux|linux|LINUX|FreeBSD|freebsd|FREEBSD)
if test -c /dev/fb0; then
enable_image=x11,fb
fi;;
@@ -6828,6 +6828,7 @@
fi;;
esac
done
+ PKG_CONFIG=pkg-config
IMGTARGETS=""
IMGLINK='$(CC)'
if test x"$with_gtk2" = xyes; then

View file

@ -1,13 +0,0 @@
--- main.c.old 2007-05-31 06:49:50.000000000 +0530
+++ main.c 2010-02-16 16:16:24.000000000 +0530
@@ -842,7 +842,9 @@
mySignal(SIGPIPE, SigPipe);
#endif
- orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
+ orig_GC_warn_proc = GC_get_warn_proc();
+ GC_set_warn_proc(wrap_GC_warn_proc);
+
err_msg = Strnew();
if (load_argc == 0) {
/* no URL specified */

View file

@ -1,11 +0,0 @@
--- scripts/w3mhelp.cgi.in.orig 2016-11-20 23:37:09.729134000 +0900
+++ scripts/w3mhelp.cgi.in 2016-11-20 23:37:31.174087000 +0900
@@ -48,7 +48,7 @@
}
# print "tlang=$tlang\n";
eval {require "w3mhelp-funcdesc.$tlang.pl";};
- if (defined(%funcdesc)) {
+ if (%funcdesc) {
$lang = $tlang;
}
}

View file

@ -1,11 +0,0 @@
--- scripts/w3mman/w3mman2html.cgi.in.orig 2016-11-20 23:34:49.225369000 +0900
+++ scripts/w3mman/w3mman2html.cgi.in 2016-11-20 23:35:23.649914000 +0900
@@ -220,7 +220,7 @@
local($p);
(! -d && -x) || return 0;
- if (! defined(%PATH)) {
+ if (! %PATH) {
for $p (split(":", $ENV{'PATH'})) {
$p =~ s@/+$@@;
$PATH{$p} = 1;

View file

@ -1,751 +0,0 @@
--- w3mimg/fb/fb.c.orig 2003-07-14 01:19:10.000000000 +0900
+++ w3mimg/fb/fb.c 2007-11-23 08:59:36.000000000 +0900
@@ -12,12 +12,24 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
+#if defined(__linux__)
#include <linux/fb.h>
+#elif defined(__FreeBSD__)
+#include <sys/fbio.h>
+#endif
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#include <machine/param.h>
+#endif
#include "fb.h"
#define FB_ENV "FRAMEBUFFER"
+#if defined(__linux__)
#define FB_DEFDEV "/dev/fb0"
+#elif defined(__FreeBSD__)
+#define FB_DEFDEV "/dev/ttyv0"
+#endif
#define MONO_OFFSET_8BIT 0x40
#define COLORS_MONO_8BIT 0x40
@@ -38,22 +50,65 @@
#define IMAGE_SIZE_MAX 10000
+#if defined(__linux__)
static struct fb_cmap *fb_cmap_create(struct fb_fix_screeninfo *,
struct fb_var_screeninfo *);
+#elif defined(__FreeBSD__)
+static video_color_palette_t *fb_cmap_create(video_info_t *video_info,
+ video_adapter_info_t *video_adapter_info);
+#endif
+#if defined(__linux__)
static void fb_cmap_destroy(struct fb_cmap *cmap);
+#elif defined(__FreeBSD__)
+static void fb_cmap_destroy(video_color_palette_t *cmap);
+#endif
+#if defined(__linux__)
static int fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo);
+#endif
+#if defined(__linux__)
static void *fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo);
+#elif defined(__FreeBSD__)
+static void *fb_mmap(int fbfp, video_adapter_info_t *video_adapter_info);
+#endif
+#if defined(__linux__)
static int fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo);
+#elif defined(__FreeBSD__)
+static int fb_munmap(void *buf, video_adapter_info_t *video_adapter_info);
+#endif
+#if defined(__linux__)
static int fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo);
+#endif
+#if defined(__linux__)
static int fb_cmap_set(int fbfp, struct fb_cmap *cmap);
+#elif defined(__FreeBSD__)
+static int fb_cmap_set(int fbfp, video_color_palette_t *cmap);
+#endif
+#if defined(__linux__)
static int fb_cmap_get(int fbfp, struct fb_cmap *cmap);
+#elif defined(__FreeBSD__)
+static int fb_cmap_get(int fbfp, video_color_palette_t *cmap);
+#endif
static int fb_cmap_init(void);
static int fb_get_cmap_index(int r, int g, int b);
static unsigned long fb_get_packed_color(int r, int g, int b);
+#if defined(__FreeBSD__)
+static int fb_video_mode_get(int fbfp, int *video_mode);
+static int fb_video_info_get(int fbfp, video_info_t *video_info);
+static int fb_video_adapter_info_get(int fbfp, video_adapter_info_t *video_adapter_info);
+#endif
+#if defined(__linux__)
static struct fb_fix_screeninfo fscinfo;
static struct fb_var_screeninfo vscinfo;
+#elif defined(__FreeBSD__)
+static video_info_t video_info;
+static video_adapter_info_t video_adapter_info;
+#endif
+#if defined(__linux__)
static struct fb_cmap *cmap = NULL, *cmap_org = NULL;
+#elif defined(__FreeBSD__)
+static video_color_palette_t *cmap = NULL, *cmap_org = NULL;
+#endif
static int is_open = FALSE;
static int fbfp = -1;
static size_t pixel_size = 0;
@@ -63,6 +118,9 @@
fb_open(void)
{
char *fbdev = { FB_DEFDEV };
+#if defined(__FreeBSD__)
+ int video_mode;
+#endif
if (is_open == TRUE)
return 1;
@@ -76,6 +134,7 @@
goto ERR_END;
}
+#if defined(__linux__)
if (fb_fscrn_get(fbfp, &fscinfo)) {
goto ERR_END;
}
@@ -83,22 +142,67 @@
if (fb_vscrn_get(fbfp, &vscinfo)) {
goto ERR_END;
}
+#elif defined(__FreeBSD__)
+ if (fb_video_mode_get(fbfp, &video_mode)) {
+ goto ERR_END;
+ }
+ video_info.vi_mode = video_mode;
+
+ if (fb_video_info_get(fbfp, &video_info)) {
+ goto ERR_END;
+ }
+
+ if (fb_video_adapter_info_get(fbfp, &video_adapter_info)) {
+ goto ERR_END;
+ }
+ if (!(video_info.vi_flags & V_INFO_GRAPHICS) ||
+ !(video_info.vi_flags & V_INFO_LINEAR)) {
+ goto ERR_END;
+ }
+#endif
+#if defined(__linux__)
if ((cmap = fb_cmap_create(&fscinfo, &vscinfo)) == (struct fb_cmap *)-1) {
goto ERR_END;
}
+#elif defined(__FreeBSD__)
+ if ((cmap = fb_cmap_create(&video_info, &video_adapter_info)) == (video_color_palette_t *)-1) {
+ goto ERR_END;
+ }
+#endif
+#if defined(__linux__)
if (!(buf = fb_mmap(fbfp, &fscinfo))) {
fprintf(stderr, "Can't allocate memory.\n");
goto ERR_END;
}
+#elif defined(__FreeBSD__)
+ if (!(buf = fb_mmap(fbfp, &video_adapter_info))) {
+ fprintf(stderr, "Can't allocate memory.\n");
+ goto ERR_END;
+ }
+#endif
+#if defined(__linux__)
if (fscinfo.type != FB_TYPE_PACKED_PIXELS) {
fprintf(stderr, "This type of framebuffer is not supported.\n");
goto ERR_END;
}
+#elif defined(__FreeBSD__)
+ if (!(video_info.vi_mem_model == V_INFO_MM_PACKED ||
+ video_info.vi_mem_model == V_INFO_MM_DIRECT)) {
+ fprintf(stderr, "This type of framebuffer is not supported.\n");
+ goto ERR_END;
+ }
+#endif
+#if defined(__linux__)
if (fscinfo.visual == FB_VISUAL_PSEUDOCOLOR && vscinfo.bits_per_pixel == 8) {
+#elif defined(__FreeBSD__)
+ if (video_adapter_info.va_flags & V_ADP_PALETTE &&
+ video_info.vi_mem_model == V_INFO_MM_PACKED &&
+ video_info.vi_depth == 8) {
+#endif
if (fb_cmap_get(fbfp, cmap)) {
fprintf(stderr, "Can't get color map.\n");
fb_cmap_destroy(cmap);
@@ -111,12 +215,20 @@
pixel_size = 1;
}
+#if defined(__linux__)
else if ((fscinfo.visual == FB_VISUAL_TRUECOLOR ||
fscinfo.visual == FB_VISUAL_DIRECTCOLOR) &&
(vscinfo.bits_per_pixel == 15 ||
vscinfo.bits_per_pixel == 16 ||
vscinfo.bits_per_pixel == 24 || vscinfo.bits_per_pixel == 32)) {
pixel_size = (vscinfo.bits_per_pixel + 7) / CHAR_BIT;
+#elif defined(__FreeBSD__)
+ else if (video_info.vi_mem_model == V_INFO_MM_DIRECT &&
+ (video_info.vi_depth == 15 ||
+ video_info.vi_depth == 16 ||
+ video_info.vi_depth == 24 || video_info.vi_depth == 32)) {
+ pixel_size = (video_info.vi_depth + 7) / CHAR_BIT;
+#endif
}
else {
fprintf(stderr, "This type of framebuffer is not supported.\n");
@@ -147,7 +259,11 @@
cmap = NULL;
}
if (buf != NULL) {
+#if defined(__linux__)
fb_munmap(buf, &fscinfo);
+#elif defined(__FreeBSD__)
+ fb_munmap(buf, &video_adapter_info);
+#endif
buf = NULL;
}
@@ -259,11 +375,19 @@
if (y + height > fb_height())
height = fb_height() - y;
+#if defined(__linux__)
offset_fb = fscinfo.line_length * y + pixel_size * x;
+#elif defined(__FreeBSD__)
+ offset_fb = video_adapter_info.va_line_width * y + pixel_size * x;
+#endif
offset_img = image->rowstride * sy + pixel_size * sx;
for (i = 0; i < height; i++) {
memcpy(buf + offset_fb, image->data + offset_img, pixel_size * width);
+#if defined(__linux__)
offset_fb += fscinfo.line_length;
+#elif defined(__FreeBSD__)
+ offset_fb += video_adapter_info.va_line_width;
+#endif
offset_img += image->rowstride;
}
@@ -336,7 +460,11 @@
if (is_open != TRUE)
return 0;
+#if defined(__linux__)
return vscinfo.xres;
+#elif defined(__FreeBSD__)
+ return video_info.vi_width;
+#endif
}
int
@@ -345,7 +473,11 @@
if (is_open != TRUE)
return 0;
+#if defined(__linux__)
return vscinfo.yres;
+#elif defined(__FreeBSD__)
+ return video_info.vi_height;
+#endif
}
int
@@ -369,7 +501,11 @@
h = fb_height() - y;
if (tmp == NULL) {
+#if defined(__linux__)
tmp = malloc(fscinfo.line_length);
+#elif defined(__FreeBSD__)
+ tmp = malloc(video_adapter_info.va_line_width);
+#endif
if (tmp == NULL)
return 1;
}
@@ -384,10 +520,18 @@
gg = g;
bb = b;
}
+#if defined(__linux__)
offset_fb = fscinfo.line_length * y + pixel_size * x;
+#elif defined(__FreeBSD__)
+ offset_fb = video_adapter_info.va_line_width * y + pixel_size * x;
+#endif
for (i = 0; i < h; i++) {
memcpy(buf + offset_fb, tmp, pixel_size * w);
+#if defined(__linux__)
offset_fb += fscinfo.line_length;
+#elif defined(__FreeBSD__)
+ offset_fb += video_adapter_info.va_line_width;
+#endif
}
return 0;
}
@@ -400,11 +544,21 @@
return fb_get_cmap_index(r, g, b);
}
else {
+#if defined(__linux__)
return
((r >> (CHAR_BIT - vscinfo.red.length)) << vscinfo.red.offset) +
((g >> (CHAR_BIT - vscinfo.green.length)) << vscinfo.green.
offset) +
((b >> (CHAR_BIT - vscinfo.blue.length)) << vscinfo.blue.offset);
+#elif defined(__FreeBSD__)
+ return
+ ((r >> (CHAR_BIT - video_info.vi_pixel_fsizes[0])) <<
+ video_info.vi_pixel_fields[0]) +
+ ((g >> (CHAR_BIT - video_info.vi_pixel_fsizes[1])) <<
+ video_info.vi_pixel_fields[1]) +
+ ((b >> (CHAR_BIT - video_info.vi_pixel_fsizes[2])) <<
+ video_info.vi_pixel_fields[2]);
+#endif
}
}
@@ -433,16 +587,31 @@
if (cmap == NULL)
return 1;
+#if defined(__linux__)
if (cmap->len < COLOR_OFFSET_8BIT + COLORS_8BIT) {
fprintf(stderr, "Can't allocate enough color.\n");
return 1;
}
+#elif defined(__FreeBSD__)
+ if (cmap->count < COLOR_OFFSET_8BIT + COLORS_8BIT) {
+ fprintf(stderr, "Can't allocate enough color.\n");
+ return 1;
+ }
+#endif
if (cmap_org == NULL) {
+#if defined(__linux__)
if ((cmap_org =
fb_cmap_create(&fscinfo, &vscinfo)) == (struct fb_cmap *)-1) {
return 1;
}
+#elif defined(__FreeBSD__)
+ if ((cmap_org =
+ fb_cmap_create(&video_info, &video_adapter_info)) ==
+ (video_color_palette_t *)-1) {
+ return 1;
+ }
+#endif
if (fb_cmap_get(fbfp, cmap_org)) {
fprintf(stderr, "Can't get color map.\n");
@@ -452,8 +621,13 @@
}
}
+#if defined(__linux__)
cmap->start = MONO_OFFSET_8BIT;
cmap->len = COLORS_8BIT + COLORS_MONO_8BIT;
+#elif defined(__FreeBSD__)
+ cmap->index = MONO_OFFSET_8BIT;
+ cmap->count = COLORS_8BIT + COLORS_MONO_8BIT;
+#endif
for (lp = 0; lp < COLORS_MONO_8BIT; lp++) {
int c;
@@ -506,73 +680,213 @@
#define LUT_MAX (256)
+#if defined(__linux__)
static struct fb_cmap *
fb_cmap_create(struct fb_fix_screeninfo *fscinfo,
struct fb_var_screeninfo *vscinfo)
+#elif defined(__FreeBSD__)
+static video_color_palette_t *
+fb_cmap_create(video_info_t *video_info,
+ video_adapter_info_t *video_adapter_info)
+#endif
{
+#if defined(__linux__)
struct fb_cmap *cmap;
+#elif defined(__FreeBSD__)
+ video_color_palette_t *cmap;
+#endif
int cmaplen = LUT_MAX;
/* check the existence of colormap */
+#if defined(__linux__)
if (fscinfo->visual == FB_VISUAL_MONO01 ||
fscinfo->visual == FB_VISUAL_MONO10 ||
fscinfo->visual == FB_VISUAL_TRUECOLOR)
return NULL;
+#elif defined(__FreeBSD__)
+ if (!(video_adapter_info->va_flags & V_ADP_PALETTE))
+ return NULL;
+#endif
+#if defined(__linux__)
cmap = (struct fb_cmap *)malloc(sizeof(struct fb_cmap));
+#elif defined(__FreeBSD__)
+ cmap = (video_color_palette_t *)malloc(sizeof(video_color_palette_t));
+#endif
if (!cmap) {
perror("cmap malloc error\n");
+#if defined(__linux__)
return (struct fb_cmap *)-1;
+#elif defined(__FreeBSD__)
+ return (video_color_palette_t *)-1;
+#endif
}
+#if defined(__linux__)
memset(cmap, 0, sizeof(struct fb_cmap));
+#elif defined(__FreeBSD__)
+ memset(cmap, 0, sizeof(video_color_palette_t));
+#endif
+
+#if defined(__FreeBSD__)
+ if (video_info->vi_mem_model == V_INFO_MM_PACKED) {
+ cmap->red = (u_char *) malloc(sizeof(u_char) * cmaplen);
+ if (!cmap->red) {
+ perror("red lut malloc error\n");
+ return (video_color_palette_t *)-1;
+ }
+ cmap->green = (u_char *) malloc(sizeof(u_char) * cmaplen);
+ if (!cmap->green) {
+ perror("green lut malloc error\n");
+ free(cmap->red);
+ return (video_color_palette_t *)-1;
+ }
+ cmap->blue = (u_char *) malloc(sizeof(u_char) * cmaplen);
+ if (!cmap->blue) {
+ perror("blue lut malloc error\n");
+ free(cmap->red);
+ free(cmap->green);
+ return (video_color_palette_t *)-1;
+ }
+ cmap->transparent = (u_char *) malloc(sizeof(u_char) * cmaplen);
+ if (!cmap->transparent) {
+ perror("transparent lut malloc error\n");
+ free(cmap->red);
+ free(cmap->green);
+ free(cmap->blue);
+ return (video_color_palette_t *)-1;
+ }
+ cmap->count = cmaplen;
+ return cmap;
+ }
+#endif
/* Allocates memory for a colormap */
+#if defined(__linux__)
if (vscinfo->red.length) {
cmap->red = (__u16 *) malloc(sizeof(__u16) * cmaplen);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[0]) {
+ cmap->red = (u_char *) malloc(sizeof(u_char) * cmaplen);
+#endif
if (!cmap->red) {
perror("red lut malloc error\n");
+#if defined(__linux__)
return (struct fb_cmap *)-1;
+#elif defined(__FreeBSD__)
+ return (video_color_palette_t *)-1;
+#endif
}
}
+#if defined(__linux__)
if (vscinfo->green.length) {
cmap->green = (__u16 *) malloc(sizeof(__u16) * cmaplen);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[1]) {
+ cmap->green = (u_char *) malloc(sizeof(u_char) * cmaplen);
+#endif
if (!cmap->green) {
+#if defined(__linux__)
if (vscinfo->red.length)
free(cmap->red);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[0])
+ free(cmap->red);
+#endif
perror("green lut malloc error\n");
+#if defined(__linux__)
return (struct fb_cmap *)-1;
+#elif defined(__FreeBSD__)
+ return (video_color_palette_t *)-1;
+#endif
}
}
+#if defined(__linux__)
if (vscinfo->blue.length) {
cmap->blue = (__u16 *) malloc(sizeof(__u16) * cmaplen);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[2]) {
+ cmap->blue = (u_char *) malloc(sizeof(u_char) * cmaplen);
+#endif
if (!cmap->blue) {
+#if defined(__linux__)
if (vscinfo->red.length)
free(cmap->red);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[0])
+ free(cmap->red);
+#endif
+#if defined(__linux__)
if (vscinfo->green.length)
free(cmap->green);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[1])
+ free(cmap->green);
+#endif
perror("blue lut malloc error\n");
+#if defined(__linux__)
return (struct fb_cmap *)-1;
+#elif defined(__FreeBSD__)
+ return (video_color_palette_t *)-1;
+#endif
}
}
+#if defined(__linux__)
if (vscinfo->transp.length) {
cmap->transp = (__u16 *) malloc(sizeof(__u16) * cmaplen);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[3]) {
+ cmap->transparent = (u_char *) malloc(sizeof(u_char) * cmaplen);
+#endif
+#if defined(__linux__)
if (!cmap->transp) {
+#elif defined(__FreeBSD__)
+ if (!cmap->transparent) {
+#endif
+#if defined(__linux__)
if (vscinfo->red.length)
free(cmap->red);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[0])
+ free(cmap->red);
+#endif
+#if defined(__linux__)
if (vscinfo->green.length)
free(cmap->green);
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[1])
+ free(cmap->green);
+#endif
+#if defined(__linux__)
if (vscinfo->blue.length)
free(cmap->blue);
perror("transp lut malloc error\n");
+#elif defined(__FreeBSD__)
+ if (video_info->vi_pixel_fsizes[2])
+ free(cmap->blue);
+ perror("transparent lut malloc error\n");
+#endif
+#if defined(__linux__)
return (struct fb_cmap *)-1;
+#elif defined(__FreeBSD__)
+ return (video_color_palette_t *)-1;
+#endif
}
}
+#if defined(__linux__)
cmap->len = cmaplen;
+#elif defined(__FreeBSD__)
+ cmap->count = cmaplen;
+#endif
return cmap;
}
+#if defined(__linux__)
static void
fb_cmap_destroy(struct fb_cmap *cmap)
+#elif defined(__FreeBSD__)
+static void
+fb_cmap_destroy(video_color_palette_t *cmap)
+#endif
{
if (cmap->red)
free(cmap->red);
@@ -580,28 +894,57 @@
free(cmap->green);
if (cmap->blue)
free(cmap->blue);
+#if defined(__linux__)
if (cmap->transp)
free(cmap->transp);
+#elif defined(__FreeBSD__)
+ if (cmap->transparent)
+ free(cmap->transparent);
+#endif
free(cmap);
}
+#if defined(__linux__)
static int
fb_cmap_get(int fbfp, struct fb_cmap *cmap)
+#elif defined(__FreeBSD__)
+static int
+fb_cmap_get(int fbfp, video_color_palette_t *cmap)
+#endif
{
+#if defined(__linux__)
if (ioctl(fbfp, FBIOGETCMAP, cmap)) {
perror("ioctl FBIOGETCMAP error\n");
return -1;
}
+#elif defined(__FreeBSD__)
+ if (ioctl(fbfp, FBIO_GETPALETTE, cmap) == -1) {
+ perror("ioctl FBIO_GETPALETTE error\n");
+ return -1;
+ }
+#endif
return 0;
}
+#if defined(__linux__)
static int
fb_cmap_set(int fbfp, struct fb_cmap *cmap)
+#elif defined(__FreeBSD__)
+static int
+fb_cmap_set(int fbfp, video_color_palette_t *cmap)
+#endif
{
+#if defined(__linux__)
if (ioctl(fbfp, FBIOPUTCMAP, cmap)) {
perror("ioctl FBIOPUTCMAP error\n");
return -1;
}
+#elif defined(__FreeBSD__)
+ if (ioctl(fbfp, FBIO_SETPALETTE, cmap) == -1) {
+ perror("ioctl FBIO_SETPALETTE error\n");
+ return -1;
+ }
+#endif
return 0;
}
@@ -612,10 +955,16 @@
* fb_munmap() deletes the mappings
*/
+#if defined(__linux__)
static void *
fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo)
+#elif defined(__FreeBSD__)
+static void *
+fb_mmap(int fbfp, video_adapter_info_t *video_adapter_info)
+#endif
{
void *buf;
+#if defined(__linux__)
if ((buf = (unsigned char *)
mmap(NULL, scinfo->smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbfp,
(off_t) 0))
@@ -623,13 +972,41 @@
perror("mmap error");
return NULL;
}
+#elif defined(__FreeBSD__)
+ size_t mmap_offset;
+ size_t mmap_length;
+ mmap_offset = (size_t)(video_adapter_info->va_window) & (PAGE_MASK);
+ mmap_length = (size_t)(video_adapter_info->va_window_size +
+ mmap_offset + PAGE_MASK) & (~PAGE_MASK);
+ if ((buf = (unsigned char *)
+ mmap(NULL, mmap_length, PROT_READ | PROT_WRITE, MAP_SHARED, fbfp,
+ (off_t) 0))
+ == MAP_FAILED) {
+ perror("mmap error");
+ return NULL;
+ }
+#endif
return buf;
}
+#if defined(__linux__)
static int
fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo)
+#elif defined(__FreeBSD__)
+static int
+fb_munmap(void *buf, video_adapter_info_t *video_adapter_info)
+#endif
{
+#if defined(__linux__)
return munmap(buf, scinfo->smem_len);
+#elif defined(__FreeBSD__)
+ size_t mmap_offset;
+ size_t mmap_length;
+ mmap_offset = (size_t)(video_adapter_info->va_window) & (PAGE_MASK);
+ mmap_length = (size_t)(video_adapter_info->va_window_size +
+ mmap_offset + PAGE_MASK) & (~PAGE_MASK);
+ return munmap((void *)((u_long)buf & (~PAGE_MASK)), mmap_length);
+#endif
}
/*
@@ -637,6 +1014,7 @@
*
* fb_fscrn_get() get information
*/
+#if defined(__linux__)
static int
fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo)
{
@@ -646,12 +1024,14 @@
}
return 0;
}
+#endif
/*
* (struct fb_var_screeninfo) device independent variable information
*
* fb_vscrn_get() get information
*/
+#if defined(__linux__)
static int
fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo)
{
@@ -661,3 +1041,41 @@
}
return 0;
}
+#endif
+
+#if defined(__FreeBSD__)
+static int
+fb_video_mode_get(int fbfp, int *video_mode)
+{
+ if (ioctl(fbfp, FBIO_GETMODE, video_mode) == -1) {
+ perror("ioctl FBIO_GETMODE error\n");
+ return -1;
+ }
+ return 0;
+}
+#endif
+
+#if defined(__FreeBSD__)
+static int
+fb_video_info_get(int fbfp, video_info_t *video_info)
+{
+ if (ioctl(fbfp, FBIO_MODEINFO, video_info) == -1) {
+ perror("ioctl FBIO_MODEINFO error\n");
+ return -1;
+ }
+ return 0;
+}
+#endif
+
+#if defined(__FreeBSD__)
+static int
+fb_video_adapter_info_get(int fbfp, video_adapter_info_t *video_adapter_info)
+{
+ if (ioctl(fbfp, FBIO_ADPINFO, video_adapter_info) == -1) {
+ perror("ioctl FBIO_ADPINFO error\n");
+ return -1;
+ }
+ return 0;
+}
+#endif
+

View file

@ -1,14 +0,0 @@
--- w3mimg/fb/fb.h.orig 2003-07-08 00:48:17.000000000 +0900
+++ w3mimg/fb/fb.h 2007-11-23 02:43:22.000000000 +0900
@@ -1,7 +1,11 @@
/* $Id: fb.h,v 1.7 2003/07/07 15:48:17 ukai Exp $ */
#ifndef fb_header
#define fb_header
+#if defined(__linux__)
#include <linux/fb.h>
+#elif defined(__FreeBSD__)
+#include <sys/fbio.h>
+#endif
typedef struct {
int num;

View file

@ -1,29 +0,0 @@
--- w3mimg/fb/fb_w3mimg.c.orig Wed Aug 4 17:32:28 2004
+++ w3mimg/fb/fb_w3mimg.c Mon Dec 3 10:42:23 2007
@@ -153,10 +153,15 @@
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 @@
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;
}

View file

@ -3,6 +3,7 @@ bin/w3mman
libexec/w3m/cgi-bin/dirlist.cgi
libexec/w3m/cgi-bin/multipart.cgi
libexec/w3m/cgi-bin/w3mbookmark
libexec/w3m/cgi-bin/w3mdict.cgi
libexec/w3m/cgi-bin/w3mhelp.cgi
libexec/w3m/cgi-bin/w3mmail.cgi
libexec/w3m/cgi-bin/w3mman2html.cgi
@ -10,44 +11,67 @@ libexec/w3m/cgi-bin/w3mhelperpanel
libexec/w3m/inflate
libexec/w3m/xface2xpm
%%INLINE_IMAGE%%libexec/w3m/w3mimgdisplay
%%JAPANESE%%man/ja/man1/w3m.1.gz
%%JAPANESE%%man/ja/man1/w3mman.1.gz
man/ja/man1/w3m.1.gz
man/ja/man1/w3mman.1.gz
man/de/man1/w3m.1.gz
man/de/man1/w3mman.1.gz
man/man1/w3m.1.gz
man/man1/w3mman.1.gz
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/FAQ.html
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/HISTORY
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/MANUAL.html
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.SSL
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.cookie
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.dict
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.func
%%PORTDOCS%%%%JAPANESE%%%%INLINE_IMAGE%%share/doc/ja/w3m/README.img
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.keymap
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.m17n
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.mailcap
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.menu
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/README.migemo
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/STORY.html
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/keymap.default
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/keymap.lynx
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/menu.default
%%PORTDOCS%%%%JAPANESE%%share/doc/ja/w3m/menu.submenu
%%PORTDOCS%%share/doc/de/w3m/FAQ.html
%%PORTDOCS%%share/doc/de/w3m/MANUAL.html
%%PORTDOCS%%share/doc/de/w3m/README.func
%%PORTDOCS%%share/doc/ja/w3m/FAQ.html
%%PORTDOCS%%share/doc/ja/w3m/HISTORY
%%PORTDOCS%%share/doc/ja/w3m/MANUAL.html
%%PORTDOCS%%share/doc/ja/w3m/README
%%PORTDOCS%%share/doc/ja/w3m/README.SSL
%%PORTDOCS%%share/doc/ja/w3m/README.cookie
%%PORTDOCS%%share/doc/ja/w3m/README.cygwin
%%PORTDOCS%%share/doc/ja/w3m/README.dict
%%PORTDOCS%%share/doc/ja/w3m/README.func
%%PORTDOCS%%share/doc/ja/w3m/README.img
%%PORTDOCS%%share/doc/ja/w3m/README.keymap
%%PORTDOCS%%share/doc/ja/w3m/README.m17n
%%PORTDOCS%%share/doc/ja/w3m/README.mailcap
%%PORTDOCS%%share/doc/ja/w3m/README.menu
%%PORTDOCS%%share/doc/ja/w3m/README.migemo
%%PORTDOCS%%share/doc/ja/w3m/README.mouse
%%PORTDOCS%%share/doc/ja/w3m/README.passwd
%%PORTDOCS%%share/doc/ja/w3m/README.pre_form
%%PORTDOCS%%share/doc/ja/w3m/README.siteconf
%%PORTDOCS%%share/doc/ja/w3m/README.tab
%%PORTDOCS%%share/doc/ja/w3m/STORY.html
%%PORTDOCS%%share/doc/ja/w3m/keymap.default
%%PORTDOCS%%share/doc/ja/w3m/keymap.lynx
%%PORTDOCS%%share/doc/ja/w3m/menu.default
%%PORTDOCS%%share/doc/ja/w3m/menu.submenu
%%PORTDOCS%%%%DOCSDIR%%/FAQ.html
%%PORTDOCS%%%%DOCSDIR%%/HISTORY
%%PORTDOCS%%%%DOCSDIR%%/MANUAL.html
%%PORTDOCS%%%%DOCSDIR%%/README
%%PORTDOCS%%%%DOCSDIR%%/README.cookie
%%PORTDOCS%%%%DOCSDIR%%/README.cygwin
%%PORTDOCS%%%%DOCSDIR%%/README.dict
%%PORTDOCS%%%%DOCSDIR%%/README.func
%%PORTDOCS%%%%INLINE_IMAGE%%%%DOCSDIR%%/README.img
%%PORTDOCS%%%%DOCSDIR%%/README.img
%%PORTDOCS%%%%DOCSDIR%%/README.m17n
%%PORTDOCS%%%%DOCSDIR%%/README.mouse
%%PORTDOCS%%%%DOCSDIR%%/README.passwd
%%PORTDOCS%%%%DOCSDIR%%/README.pre_form
%%PORTDOCS%%%%DOCSDIR%%/README.siteconf
%%PORTDOCS%%%%DOCSDIR%%/README.sixel
%%PORTDOCS%%%%DOCSDIR%%/README.tab
%%PORTDOCS%%%%DOCSDIR%%/STORY.html
%%PORTDOCS%%%%DOCSDIR%%/keymap.default
%%PORTDOCS%%%%DOCSDIR%%/keymap.lynx
%%PORTDOCS%%%%DOCSDIR%%/menu.default
%%PORTDOCS%%%%DOCSDIR%%/menu.submenu
%%JAPANESE%%share/locale/ja/LC_MESSAGES/w3m.mo
share/w3m/w3mhelp-funcdesc.en.pl
share/w3m/w3mhelp-funcdesc.ja.pl
share/w3m/w3mhelp-funcname.pl
share/w3m/w3mhelp.html
%%NLS%%share/locale/de/LC_MESSAGES/w3m.mo
%%NLS%%share/locale/ja/LC_MESSAGES/w3m.mo
%%NLS%%share/locale/zh_CN/LC_MESSAGES/w3m.mo
%%NLS%%share/locale/zh_TW/LC_MESSAGES/w3m.mo
%%DATADIR%%/w3mhelp-funcdesc.de.pl
%%DATADIR%%/w3mhelp-funcdesc.en.pl
%%DATADIR%%/w3mhelp-funcdesc.ja.pl
%%DATADIR%%/w3mhelp-funcname.pl
%%DATADIR%%/w3mhelp.html