the first fail if no string is entered (56) [FIXED].
- Page down on a file of editwinrows fails (again). Reported by Ryan
Krebs (57) [FIXED].
-- File browser aborts on Solaris in qsort() call. (Reported by
- Matthias Andree) (58) [FIXED by Matthias Andree].
** Open BUGS **
+- File browser aborts on Solaris in qsort() call. (Reported by
+ Matthias Andree) (58).
+
$Id$
- Fixed typo in section 6.1 (discovered by Bob Farmer).
- files.c:
diralphasort()
- - Changed stat calls to lstat to stop abort on symlinks, otherwise
- return 0. (Matthias Andree, fixes bug #58)
+ - Stop abort on symlinks (Matthias Andree)
+ fielstat(), do_browse()
+ - Changed lstat calls to stat, which fixes the browser not
+ following links to directories. We only use lstat() when
+ printing the details of the file, and if it is a link, then
+ check via lstat() for link to a directory. If it is
+ a directory, display (dir), else use the normal "--".
nano-1.0.0 - 03/22/2001
- General
struct stat filestat(const char *path) {
struct stat st;
- lstat(path, &st);
+ stat(path, &st);
return st;
}
char *a = *(char **)va, *b = *(char **)vb;
int answer = 0;
- if ((lstat(a, &file1info) != -1) && (lstat(b, &file2info) != -1)) {
+ if ((stat(a, &file1info) != -1) && (stat(b, &file2info) != -1)) {
/* If is a is a dir and b isn't, return -1.
Else if b is a dir and a isn't, return 0.
Else return a < b */
col += strlen(foo);
/* Put file info in the string also */
- st = filestat(filelist[j]);
+ /* We use lstat here to detect links, then if we find a
+ symlink we examine it via stat() to see if it is a
+ directory or just a file symlink */
+ lstat(filelist[j], &st);
if (S_ISDIR(st.st_mode))
strcpy(foo + longest - 5, "(dir)");
else {
- if (S_ISLNK(st.st_mode))
- strcpy(foo + longest - 2, "--");
- else if (st.st_size < 1024) /* less than 1 K */
+ if (S_ISLNK(st.st_mode)) {
+ /* Aha! It's a symlink! Now, is it a dir? If so,
+ mark it as such */
+ st = filestat(filelist[j]);
+ if (S_ISDIR(st.st_mode))
+ strcpy(foo + longest - 5, "(dir)");
+ else
+ 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);