commit e3d44e28682124f1ac7f1b6000af61099eabc705
parent 61ab30ba3d0f60c79076d4ae2c5ed5adfa7fbe05
Author: ukai <ukai>
Date: Mon, 22 Jul 2002 16:27:30 +0000
[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:
5 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,4 +1,12 @@
2002-07-23 Hiroyuki Ito <hito@crl.go.jp>
+
+ * [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
+
+2002-07-23 Hiroyuki Ito <hito@crl.go.jp>
* [w3m-dev 03279] w3m-img for framebuffer update
http://homepage3.nifty.com/slokar/fb/w3mfb.patch.gz
diff --git a/NEWS b/NEWS
@@ -1,5 +1,6 @@
w3m 0.4?
+* rc: imgsize: obsoleted
* w3m-img for framebuffer merged
----------------------------------------------------------------
diff --git a/fm.h b/fm.h
@@ -822,7 +822,6 @@ global int showLineNum init(FALSE);
global int show_srch_str init(TRUE);
#ifdef USE_IMAGE
global char *Imgdisplay init(IMGDISPLAY);
-global char *Imgsize init(IMGSIZE);
global int activeImage init(FALSE);
global int displayImage init(TRUE);
global int autoImage init(TRUE);
diff --git a/image.c b/image.c
@@ -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;
diff --git a/rc.c b/rc.c
@@ -494,7 +494,6 @@ struct param_ptr params1[] = {
NULL},
{"imgdisplay", P_STRING, PI_TEXT, (void *)&Imgdisplay, CMT_IMGDISPLAY,
NULL},
- {"imgsize", P_STRING, PI_TEXT, (void *)&Imgsize, CMT_IMGSIZE, NULL},
#endif
{"show_lnum", P_INT, PI_ONOFF, (void *)&showLineNum, CMT_SHOW_NUM, NULL},
{"show_srch_str", P_INT, PI_ONOFF, (void *)&show_srch_str,