nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit f0999a18f0ef7a5084c03dca518ab25f7de7ef33
parent 63c8ab94fbc7f1d10805e671e2d073f8d05dc4ea
Author: Chris Allegretta <chrisa@asty.org>
Date:   Thu,  4 Jan 2001 02:49:56 +0000

use lstat instead of stat in filestat, so we can check for if the file is a symlink in the browser


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@438 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
Mfiles.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/files.c b/files.c @@ -1054,7 +1054,7 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace) struct stat filestat(const char *path) { struct stat st; - stat(path, &st); + lstat(path, &st); return st; } @@ -1327,7 +1327,9 @@ char *do_browser(char *inpath) if (S_ISDIR(st.st_mode)) strcpy(foo + longest - 5, "(dir)"); else { - if (st.st_size < 1024) /* less than 1 K */ + if (S_ISLNK(st.st_mode)) + strcpy(foo + longest - 2, "--"); + else if (st.st_size < 1024) /* less than 1 K */ sprintf(foo + longest - 7, "%4d B", (int) st.st_size); else if (st.st_size > 1073741824) /* at least 1 gig */ sprintf(foo + longest - 7, "%4d GB", (int) st.st_size / 1073741824);