aboutsummaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-11-27 16:46:30 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-11-27 16:46:30 +0000
commit93073107389ae6612068af8b99217c90c87e8612 (patch)
treecc87d0189d5f125b60f64019f9803e37074cc025 /image.c
parentfix indent (diff)
downloadw3m-93073107389ae6612068af8b99217c90c87e8612.tar.gz
w3m-93073107389ae6612068af8b99217c90c87e8612.zip
[w3m-dev 03497] incorrect image size
* image.c (getImageSize): invoke w3mimgdiplay -size instead of "5;..." * w3mimgdisplay.c (defined_size): added (main): if defined_size get_image_size() (GetOption): -size From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'image.c')
-rw-r--r--image.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/image.c b/image.c
index e2aaeaa..c2873a8 100644
--- a/image.c
+++ b/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.20 2002/11/24 16:02:22 ukai Exp $ */
+/* $Id: image.c,v 1.21 2002/11/27 16:46:34 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
@@ -589,6 +589,7 @@ int
getImageSize(ImageCache * cache)
{
Str tmp;
+ FILE *f;
int w = 0, h = 0;
if (!activeImage)
@@ -597,21 +598,18 @@ getImageSize(ImageCache * cache)
(cache->width > 0 && cache->height > 0))
return FALSE;
tmp = Strnew();
- if (!(Imgdisplay_rf && Imgdisplay_wf)) {
- if (!openImgdisplay())
- return FALSE;
- }
- 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 (!strchr(Imgdisplay, '/'))
+ Strcat_m_charp(tmp, w3m_auxbin_dir(), "/", NULL);
+ Strcat_m_charp(tmp, Imgdisplay, " -size ", shell_quote(cache->file),
+ " 2> /dev/null", NULL);
+ f = popen(tmp->ptr, "r");
+ if (!f)
+ return FALSE;
+ while (fscanf(f, "%d %d", &w, &h) < 0) {
+ if (feof(f))
+ break;
}
+ pclose(f);
if (!(w > 0 && h > 0))
return FALSE;