diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-03-13 17:04:56 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-03-13 17:04:56 +0000 |
commit | b118dd18d3e0b3829e6814af684e30d683b7e67d (patch) | |
tree | 2bc798345dccf998435a18c7d3ce6caf1c9a2e79 /file.c | |
parent | [w3m-dev 03126] reshapeBuffer() and -m option (diff) | |
download | w3m-b118dd18d3e0b3829e6814af684e30d683b7e67d.tar.gz w3m-b118dd18d3e0b3829e6814af684e30d683b7e67d.zip |
[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
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | file.c | 43 |
1 files changed, 42 insertions, 1 deletions
@@ -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 { |