aboutsummaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-07-22 16:27:30 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-07-22 16:27:30 +0000
commitf855d5410ef1b23e659e26c175676ce49e4072e1 (patch)
tree3da7c452f2cfa7ed3f86ada0371b51602e99e4d6 /image.c
parent[w3m-dev 03279] w3m-img for framebuffer update (diff)
downloadw3m-f855d5410ef1b23e659e26c175676ce49e4072e1.tar.gz
w3m-f855d5410ef1b23e659e26c175676ce49e4072e1.zip
[w3m-dev 03280] w3m-img without w3mimgsize
* fm.h (Imagesize): deleted * image.c (getImageSize): rewrite to use w3mimgdisplay instead of w3mimgsize * rc.c (params1): remove imgsize, merged to imgdisplay From: Hiroyuki Ito <hito@crl.go.jp>
Diffstat (limited to 'image.c')
-rw-r--r--image.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/image.c b/image.c
index 3d2921a..9deedd9 100644
--- a/image.c
+++ b/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.9 2002/04/17 02:36:45 ukai Exp $ */
+/* $Id: image.c,v 1.10 2002/07/22 16:27:31 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
@@ -588,7 +588,6 @@ int
getImageSize(ImageCache * cache)
{
Str tmp;
- FILE *f;
int w = 0, h = 0;
if (!activeImage)
@@ -597,18 +596,21 @@ getImageSize(ImageCache * cache)
(cache->width > 0 && cache->height > 0))
return FALSE;
tmp = Strnew();
- if (!strchr(Imgsize, '/'))
- Strcat_m_charp(tmp, w3m_lib_dir(), "/", NULL);
- Strcat_m_charp(tmp, Imgsize, " ", shell_quote(cache->file),
- " 2> /dev/null", NULL);
- f = popen(tmp->ptr, "r");
- if (!f)
+ if (!(Imgdisplay_rf && Imgdisplay_wf)) {
+ if (!openImgdisplay())
return FALSE;
- while (fscanf(f, "%d %d", &w, &h) < 0) {
- if (feof(f))
- break;
}
- pclose(f);
+ fputs("5;", Imgdisplay_wf); /* Get Size */
+ fputs(cache->file, Imgdisplay_wf);
+ fputs("\n", Imgdisplay_wf);
+ fflush(Imgdisplay_wf);
+ {
+ char buf[1024];
+ fgets(buf, sizeof(buf), Imgdisplay_rf);
+ if(sscanf(buf, "%d %d", &w, &h) != 2) {
+ return FALSE;
+ }
+ }
if (!(w > 0 && h > 0))
return FALSE;