Jim Meyering
859428bfaa
Fix the bug that would make du /' omit the /' on the last line.
...
E.g., `du --exclude '[^/]*' -x /' would print only "4\t\n" for me.
(ftw_dir): Don't clobber the leading `/'.
Reported by Chris Lesniewski as http://bugs.debian.org/200542 .
2003-07-09 10:00:42 +00:00
Jim Meyering
17adb8367a
(ftw_startup): Always call free_cwd after restore_cwd.
2003-05-12 14:51:02 +00:00
Jim Meyering
a8916294ec
(struct dummy): Ensure that at least the number of
...
initializers matches the number of members in the corresponding enum.
2003-05-05 07:54:19 +00:00
Jim Meyering
75fa058191
Avoid array overrun.
...
(nftw_arr): Update to reflect complete list of members.
(ftw_arr): Likewise
2003-05-05 07:31:49 +00:00
Jim Meyering
c8e3afa388
DJGPP doesn't have S_ISLNK, so provide a replacement.
...
(S_IFMT): Define, if necessary.
[STAT_MACROS_BROKEN]: Undefine S_ISLNK.
(S_ISLNK): Define, if necessary.
2003-03-19 19:33:12 +00:00
Jim Meyering
e01be0a128
(FTW_STAT): Rename from `STAT', to avoid conflict
...
with STAT definition from <sys/dir.h> on AIX 5.1.
2003-03-17 21:00:48 +00:00
Jim Meyering
3d23ede4eb
Include "save-cwd.h".
...
(ftw_startup): Avoid use of getcwd, if possible.
Instead, use fopen/fchdir via save_cwd/restore_cwd.
2003-03-09 09:22:55 +00:00
Jim Meyering
b70ecc4de1
Fix a bug that causes du to dump core on 64-bit systems.
...
(ftw_startup): Declare `func' parameter to be of type
NFTW_FUNC_T, not void* which may be smaller on 64-bit systems.
Remove now-unnecessary cast.
(FTW_NAME): Cast func argument to type `NFTW_FUNC_T'.
2003-03-06 14:14:16 +00:00
Jim Meyering
ad9e0f6824
(ftw_startup): Return -1 if alloca fails.
2003-02-28 14:44:34 +00:00
Jim Meyering
7f2df50cee
Include <sys/types.h> before <dirent.h>.
...
This is required for Apple Darwin 6.3 (MacOS 10.2.3).
2003-02-21 07:06:33 +00:00
Jim Meyering
f95d4f7696
tweak comment
2003-02-12 20:48:49 +00:00
Jim Meyering
5c13851e62
(ftw_startup): Don't shadow outer declaration of save_err.
...
Merge inconsequential changes from libc.
2003-02-08 18:19:57 +00:00
Jim Meyering
f99cc7ac67
(ftw_startup): When using FTW_CHDIR, always remember
...
the current directory, not just when DIR contains a slash.
2003-02-08 17:07:38 +00:00
Jim Meyering
0876c5bbd3
Merge inconsequential changes from libc.
...
Include limits.h earlier.
Move PATH_MAX definition `down' a little; add comment.
Rename local, saved_errno to save_err.
2003-02-07 09:28:50 +00:00
Jim Meyering
5a5f1c2340
(ftw_startup): When using FTW_DEPTH, call `func', the
...
user-supplied callback, once for the current directory before calling
ftw_dir, in case that part of the hierarchy should be pruned.
`func' does that by setting `data->skip'.
2003-02-05 20:19:31 +00:00
Jim Meyering
03975e728d
Include <limits.h>.
...
(PATH_MAX): Define to 1024, if not already defined.
(process_entry): Allocate enough space to hold the resulting
file name. Don't presume that 2*dirbufsize is enough.
(ftw_startup): Always use PATH_MAX to compute buffer size, now that
it is guaranteed to be defined.
2003-02-05 16:35:07 +00:00
Jim Meyering
6e6188765a
(process_entry): When using FTW_DEPTH, call `func',
...
the user-supplied callback, once before any of its entries,
in case that part of the hierarchy should be pruned. `func'
does that by setting `data->skip'.
2003-02-05 15:08:15 +00:00
Jim Meyering
670e4e061a
(lstat) [LSTAT_FOLLOWS_SLASHED_SYMLINK]: Define to rpl_lstat.
2003-02-02 17:14:59 +00:00
Jim Meyering
91b31aa87c
[_LIBC] (ISSLASH, FILESYSTEM_PREFIX_LEN): Define.
...
(base_name): New function.
(ftw_startup): Don't strip trailing slashes.
Use base_name to find the offset of the basename.
2003-01-25 20:32:44 +00:00
Jim Meyering
431d1b6241
(object_compare): Compare inode numbers before device numbers.
...
The former is much more likely to differ for any two given file objects.
2003-01-25 16:44:07 +00:00
Jim Meyering
0eb62f18b3
Add autoconf-recommended block of alloca-related code.
...
[!_LIBC] (__getcwd): Define to xgetcwd and declare xgetcwd.
2003-01-23 20:12:08 +00:00
Jim Meyering
1f91d7b6de
(find_object): Don't use c99-style struct initializer.
2003-01-22 20:46:08 +00:00
Jim Meyering
f0a528b13a
(process_entry): Handle FTW_DCHP.
...
(ftw_dir): Handle FTW_DCH.
2003-01-22 15:45:48 +00:00
Jim Meyering
eb7d21ab94
Include autoconf-recommended block of dirent/NAMELEN
...
related definitions and includes. Use NAMELEN throughout,
rather than _D_EXACT_NAMLEN.
[_LIBC]: Define NAMELEN to _D_EXACT_NAMLEN.
(stpcpy): Declare, if necessary.
(mempcpy): Define, if necessary.
[!_LIBC] (__stpcpy, __mempcpy): Define.
[!_LIBC] (LXSTAT, XSTAT): Define.
2003-01-22 13:13:04 +00:00
Jim Meyering
92602ead01
Merge in Ulrich's and my changes from libc.
2003-01-14 12:58:22 +00:00
Jim Meyering
398ca04327
tweak comments
2003-01-12 18:16:31 +00:00
Jim Meyering
4e95cd2dff
Also work on systems that have `struct direct', using autoconf's AC_HEADER_DIRENT.
2003-01-12 18:03:48 +00:00
Jim Meyering
376e889123
(ftw_startup): Rename local-shadowing local to pacify gcc.
2003-01-12 17:01:48 +00:00
Jim Meyering
cce1b15448
New file, from glibc/io.
2003-01-12 16:48:56 +00:00