Fix style(9) bug; use ISDOT[DOT,]() macro available in util.c by moving

it to make.h so both dir.c and util.c can use it, although bde didn't
particularly like this part of the idea, IMO it's cleaner than it was.

Submitted by:	bde
This commit is contained in:
Will Andrews 2001-01-21 08:24:41 +00:00
parent 012b895034
commit e3cb529472
3 changed files with 9 additions and 11 deletions

View File

@ -1067,15 +1067,14 @@ Dir_AddDir (path, name)
}
#endif /* sun && d_ino */
/* Skip the '.' and '..' entries by checking for them specifically
* instead of assuming readdir() reuturns them in that order when
* first going through a directory. This is needed for XFS over
* NFS filesystems since SGI does not guarantee that these are the
* first two entries returned from readdir().
/* Skip the '.' and '..' entries by checking for them
* specifically instead of assuming readdir() reuturns them in
* that order when first going through a directory. This is
* needed for XFS over NFS filesystems since SGI does not
* guarantee that these are * the first two entries returned
* from readdir().
*/
if (dp->d_name[0] == '.' &&
(dp->d_name[1] == NULL ||
(dp->d_name[1] == '.' && dp->d_name[2] == NULL)))
if (ISDOT(dp->d_name) || ISDOTDOT(dp->d_name))
continue;
(void)Hash_CreateEntry(&p->files, dp->d_name, (Boolean *)NULL);

View File

@ -365,6 +365,8 @@ extern int debug;
#endif /* __STDC__ */
#define DEBUG(module) (debug & CONCAT(DEBUG_,module))
#define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/')))
#define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1])))
/*
* Since there are so many, all functions that return non-integer values are

View File

@ -155,9 +155,6 @@ signal(s, a)) ()
#ifndef DEV_DEV_COMPARE
# define DEV_DEV_COMPARE(a, b) ((a) == (b))
#endif
#define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/')))
#define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1])))
/* strrcpy():
* Like strcpy, going backwards and returning the new pointer