From a8831d96bdd3caf44bccbc0356daa8c1195c5c6b Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Mon, 4 Feb 2002 15:18:41 +0000 Subject: [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 * 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 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 --- local.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'local.c') diff --git a/local.c b/local.c index ede5aaf..d204ab3 100644 --- a/local.c +++ b/local.c @@ -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 #include #include #include +#include #include #include #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]  "); -#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, "
\n"); } } -- cgit v1.2.3