diff options
Diffstat (limited to '')
-rw-r--r-- | local.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -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] "); -#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"); } } |