From f855d5410ef1b23e659e26c175676ce49e4072e1 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Mon, 22 Jul 2002 16:27:30 +0000 Subject: [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 --- image.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'image.c') 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 @@ -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; -- cgit v1.2.3