mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
* src/system.h (DOT_OR_DOTDOT): Remove macro. Rewrite as a...
(dot_or_dotdot): ...new static inline function. * src/remove.c (rm_1): Reflect this renaming. * src/ls.c (basename_is_dot_or_dotdot): Likewise.
This commit is contained in:
1 parent
0a94897cfe
commit
0744662509
4 files changed
+16
-6
No files matched your search
@@ -1,5 +1,10 @@
|
||||
2006-08-27 Jim Meyering <jim@meyering.net>
|
||||
|
||||
* src/system.h (DOT_OR_DOTDOT): Remove macro. Rewrite as a...
|
||||
(dot_or_dotdot): ...new static inline function.
|
||||
* src/remove.c (rm_1): Reflect this renaming.
|
||||
* src/ls.c (basename_is_dot_or_dotdot): Likewise.
|
||||
|
||||
* src/copy.c (copy_internal): Add comments.
|
||||
|
||||
2006-08-26 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
@@ -2814,7 +2814,7 @@ static bool
|
||||
basename_is_dot_or_dotdot (const char *name)
|
||||
{
|
||||
char const *base = last_component (name);
|
||||
return DOT_OR_DOTDOT (base);
|
||||
return dot_or_dotdot (base);
|
||||
}
|
||||
|
||||
/* Remove any entries from FILES that are for directories,
|
||||
|
||||
+1
-1
@@ -1372,7 +1372,7 @@ rm_1 (Dirstack_state *ds, char const *filename,
|
||||
struct rm_options const *x, int *cwd_errno)
|
||||
{
|
||||
char const *base = last_component (filename);
|
||||
if (DOT_OR_DOTDOT (base))
|
||||
if (dot_or_dotdot (base))
|
||||
{
|
||||
error (0, 0, _("cannot remove `.' or `..'"));
|
||||
return RM_ERROR;
|
||||
|
||||
+9
-4
@@ -447,9 +447,14 @@ uid_t getuid ();
|
||||
#include "unlocked-io.h"
|
||||
#include "same-inode.h"
|
||||
|
||||
#define DOT_OR_DOTDOT(Basename) \
|
||||
(Basename[0] == '.' && (Basename[1] == '\0' \
|
||||
|| (Basename[1] == '.' && Basename[2] == '\0')))
|
||||
static inline bool
|
||||
dot_or_dotdot (char const *file_name)
|
||||
{
|
||||
return (file_name[0] == '.'
|
||||
&& (file_name[1] == '\0'
|
||||
|| (file_name[1] == '.'
|
||||
&& file_name[2] == '\0')));
|
||||
}
|
||||
|
||||
/* A wrapper for readdir so that callers don't see entries for `.' or `..'. */
|
||||
static inline struct dirent const *
|
||||
@@ -458,7 +463,7 @@ readdir_ignoring_dot_and_dotdot (DIR *dirp)
|
||||
while (1)
|
||||
{
|
||||
struct dirent const *dp = readdir (dirp);
|
||||
if (dp == NULL || ! DOT_OR_DOTDOT (dp->d_name))
|
||||
if (dp == NULL || ! dot_or_dotdot (dp->d_name))
|
||||
return dp;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user