diff options
Diffstat (limited to '')
-rw-r--r-- | image.c | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -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; |