aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog14
-rw-r--r--NEWS5
-rw-r--r--config.h.dist2
-rwxr-xr-xconfigure5
-rw-r--r--file.c43
-rw-r--r--scripts/Makefile2
-rw-r--r--scripts/xface2xbm.in54
7 files changed, 121 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 64099f3..7a73e84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2002-03-14 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03127] X-Face
+ * NEWS: X-Face support
+ * configure (use_xface): added
+ * config.h.dist (USE_XFACE): added
+ (XFACE2XBM): added
+ * file.c (xface2xbm): added
+ (readHeader): X-Face: handling
+ * scripts/Makefile (LIB_TARGETS): add xface2xbm
+ * scripts/xface2xbm.in: added
+
+2002-03-14 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03126] reshapeBuffer() and -m option
* buffer.c (reshapeBuffer): fix reshapeBuffer() in case of -m option
@@ -3137,4 +3149,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.346 2002/03/13 15:51:36 ukai Exp $
+$Id: ChangeLog,v 1.347 2002/03/13 17:04:56 ukai Exp $
diff --git a/NEWS b/NEWS
index e5a6e4c..be79ae7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+w3m 0.4?
+
+* X-Face support: USE_XFACE, require uncompface
+
+----------------------------------------------------------------
w3m 0.3 - 2002-03-06
* rc: mailer
diff --git a/config.h.dist b/config.h.dist
index ac01f1a..0e249ba 100644
--- a/config.h.dist
+++ b/config.h.dist
@@ -123,6 +123,7 @@ MODEL=Linux.i686-monster-ja
#undef USE_ALARM
#undef USE_IMAGE
#define USE_HELP_CGI
+#undef USE_XFACE
#define DEF_EDITOR "/bin/vi"
#define DEF_MAILER "/bin/mail"
@@ -143,6 +144,7 @@ MODEL=Linux.i686-monster-ja
#define W3MCONFIG "w3mconfig"
#define IMGSIZE "w3mimgsize"
#define IMGDISPLAY "w3mimgdisplay"
+#define XFACE2XBM "xface2xbm"
#define RC_DIR "~/.w3m"
#define BOOKMARK "bookmark.html"
diff --git a/configure b/configure
index ce072f0..a12c7f3 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#!/bin/sh
-# $Id: configure,v 1.63 2002/03/06 03:32:10 ukai Exp $
+# $Id: configure,v 1.64 2002/03/13 17:04:56 ukai Exp $
# Configuration.
#
@@ -770,6 +770,7 @@ def_param vi_prec_num $include_opt
def_param label_topline $include_opt
def_param nextpage_topline $include_opt
def_param ftppass_hostnamegen $include_opt
+def_param use_xface $use_image
def_param table_expand n
def_param table_no_compact n
@@ -2127,6 +2128,7 @@ $def_use_gopher
$def_use_alarm
$def_use_image
$def_use_help_cgi
+$def_use_xface
#define DEF_EDITOR "$editor"
#define DEF_MAILER "$mailer"
@@ -2147,6 +2149,7 @@ $def_use_help_cgi
#define W3MCONFIG "w3mconfig"
#define IMGSIZE "w3mimgsize"
#define IMGDISPLAY "w3mimgdisplay"
+#define XFACE2XBM "xface2xbm"
#define RC_DIR "~/.w3m"
#define BOOKMARK "bookmark.html"
diff --git a/file.c b/file.c
index 580397c..74857e0 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.83 2002/03/13 15:48:20 ukai Exp $ */
+/* $Id: file.c,v 1.84 2002/03/13 17:04:56 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -504,6 +504,26 @@ matchattr(char *p, char *attr, int len, Str *value)
return 0;
}
+#ifdef USE_IMAGE
+#ifdef USE_XFACE
+static char *
+xface2xbm(char *xface)
+{
+ char *xbm;
+ FILE *f;
+
+ xbm = tmpfname(TMPF_DFL, ".xbm")->ptr;
+ pushText(fileToDelete, xbm);
+ f = popen(Sprintf("%s > %s", libFile(XFACE2XBM), xbm)->ptr, "w");
+ if (!f)
+ return NULL;
+ fprintf(f, "%s", xface);
+ pclose(f);
+ return xbm;
+}
+#endif
+#endif
+
void
readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
{
@@ -589,6 +609,27 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
lineBuf2->length, -1);
for (; *q && (*q == '\r' || *q == '\n'); q++) ;
}
+#ifdef USE_IMAGE
+#ifdef USE_XFACE
+ if (thru && !strncasecmp(tmp->ptr, "X-Face:", 7)) {
+ char *tmpf;
+ Str src;
+ URLFile f;
+ Line *l;
+
+ tmpf = xface2xbm(&tmp->ptr[7]);
+ if (tmpf) {
+ src = Sprintf("<img src=\"%s\" alt=\"X-Face\" width=48 height=48>",
+ html_quote(tmpf));
+ init_stream(&f, SCM_LOCAL, newStrStream(src));
+ loadHTMLstream(&f, newBuf, NULL, TRUE);
+ for (l = newBuf->lastLine; l && l->real_linenumber;
+ l = l->prev)
+ l->real_linenumber = 0;
+ }
+ }
+#endif
+#endif
lineBuf2 = tmp;
}
else {
diff --git a/scripts/Makefile b/scripts/Makefile
index 239378f..af1cd79 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -6,7 +6,7 @@ LIB_DIR = $(prefix)/lib/w3m
HELP_DIR = $(prefix)/lib/w3m
RC_DIR = ~/.w3m
-LIB_TARGETS = dirlist.cgi w3mhelp.cgi w3mmail.cgi
+LIB_TARGETS = dirlist.cgi w3mhelp.cgi w3mmail.cgi xface2xbm
HELP_LIBS = w3mhelp-funcname.pl w3mhelp-funcdesc.pl
MKDIR = mkdir -p
diff --git a/scripts/xface2xbm.in b/scripts/xface2xbm.in
new file mode 100644
index 0000000..2c2002a
--- /dev/null
+++ b/scripts/xface2xbm.in
@@ -0,0 +1,54 @@
+#!@PERL@
+
+# See http://www.lab3.kuis.kyoto-u.ac.jp/~tsumura/emacs/x-face.html
+$UNCOMPFACE = "uncompface";
+
+$xf = "";
+while(<>) {
+# s/^X-Face://i if ($xf eq "");
+ $xf .= $_;
+}
+
+pipe(R, W2);
+pipe(R2, W);
+if (! fork()) {
+ close(R);
+ close(W);
+ open(STDIN, "<&R2");
+ open(STDOUT, ">&W2");
+ exec $UNCOMPFACE;
+ die;
+}
+close(R2);
+close(W2);
+print W $xf;
+close(W);
+while(<R>) {
+ while(s/0x(..)(..)//) {
+ push(@bm, hex($1), hex($2));
+ }
+}
+close(R);
+
+$W = 48;
+$H = @bm * 8 / $W; # must be 48
+print <<EOF;
+#define xf_width $W
+#define xf_height $H
+static char xf_bits[] = {
+EOF
+while (@bm) {
+ for (1..6) {
+ $x = shift @bm;
+ $y = 0;
+ for $i (1 .. 8) {
+ $y |= ($x & 1) << (8 - $i);
+ $x >>= 1;
+ }
+ printf " 0x%02X,", $y;
+ }
+ print "\n";
+}
+print <<EOF;
+};
+EOF