[w3m-dev 02984] inline image improvements and cleanups

* config.h.dist (HAVE_SYMLINK) added
* config.h.dist (HAVE_LSTAT): added
* configure: symlink() check
* configure: lstat() check
* fm.h (maxLoadImage): added
* form.c (form_write_from_file): s/HAVE_READLINK/HAVE_LSTAT/
* image.c: include <sys/stat.h>
* image.c (MAX_LOAD_IMAGE): default 8
* image.c (max_load_image): deleted
* image.c (n_load_image): added
* image.c (showImageProgress): added
* image.c (loadImage): check load image count
			s/HAVE_READLINK/HAVE_LSTAT/ (HAVE_SYMLINK)
			showImageProgress
* local.c: include <sys/stat.h>
		s/HAVE_READLINK/HAVE_LSTAT/
* rc.c (CMT_MAX_LOAD_IMAGE): added
* rc.c (max_load_image): added
* doc/README.img: update
* doc-jp/README.img: update

* file.c (process_img): pre_int fix
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2002-02-04 15:18:41 +00:00
parent 53b9c12956
commit a8831d96bd
11 changed files with 183 additions and 86 deletions

19
local.c
View File

@@ -1,9 +1,10 @@
/* $Id: local.c,v 1.13 2001/12/03 18:29:37 ukai Exp $ */
/* $Id: local.c,v 1.14 2002/02/04 15:18:42 ukai Exp $ */
#include "fm.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <errno.h>
#ifdef HAVE_READLINK
@@ -43,10 +44,12 @@ dirBuffer(char *dname)
char **flist;
char *p, *qdir;
Str fbuf = Strnew();
#ifdef HAVE_READLINK
#ifdef HAVE_LSTAT
struct stat lst;
#ifdef HAVE_READLINK
char lbuf[1024];
#endif /* HAVE_READLINK */
#endif /* HAVE_LSTAT */
int i, l, nrow = 0, n = 0, maxlen = 0;
int nfile, nfile_max = 100;
Str dirname;
@@ -94,10 +97,10 @@ dirBuffer(char *dname)
if (Strlastchar(fbuf) != '/')
Strcat_char(fbuf, '/');
Strcat_charp(fbuf, p);
#ifdef HAVE_READLINK /* readlink == lstat() ? (ukai) */
#ifdef HAVE_LSTAT
if (lstat(fbuf->ptr, &lst) < 0)
continue;
#endif /* READLINK */
#endif /* HAVE_LSTAT */
if (stat(fbuf->ptr, &st) < 0)
continue;
if (multicolList) {
@@ -107,10 +110,10 @@ dirBuffer(char *dname)
else {
if (S_ISDIR(st.st_mode))
Strcat_charp(tmp, "[DIR]&nbsp; ");
#ifdef HAVE_READLINK
#ifdef HAVE_LSTAT
else if (S_ISLNK(lst.st_mode))
Strcat_charp(tmp, "[LINK] ");
#endif /* HAVE_READLINE */
#endif /* HAVE_LSTAT */
else
Strcat_charp(tmp, "[FILE] ");
}
@@ -131,7 +134,7 @@ dirBuffer(char *dname)
}
}
else {
#ifdef HAVE_READLINK
#if defined(HAVE_LSTAT) && defined(HAVE_READLINK)
if (S_ISLNK(lst.st_mode)) {
if ((l = readlink(fbuf->ptr, lbuf, sizeof(lbuf))) > 0) {
lbuf[l] = '\0';
@@ -141,7 +144,7 @@ dirBuffer(char *dname)
Strcat_char(tmp, '/');
}
}
#endif /* HAVE_READLINK */
#endif /* HAVE_LSTAT && HAVE_READLINK */
Strcat_charp(tmp, "<br>\n");
}
}