Use S_IS*().
This commit is contained in:
parent
cfbbe9b764
commit
f5ad44b6ac
@ -39,7 +39,7 @@ static char copyright[] =
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)csh.c 8.2 (Berkeley) 10/12/93";*/
|
||||
static char *rcsid = "$Id: csh.c,v 1.10 1995/01/20 18:23:34 mycroft Exp $";
|
||||
static char *rcsid = "$Id: csh.c,v 1.11 1995/01/30 19:37:23 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -1312,7 +1312,7 @@ defaultpath()
|
||||
blkp = blk = (Char **) xmalloc((size_t) sizeof(Char *) * 10);
|
||||
|
||||
#define DIRAPPEND(a) \
|
||||
if (stat(ptr = a, &stb) == 0 && (stb.st_mode & S_IFMT) == S_IFDIR) \
|
||||
if (stat(ptr = a, &stb) == 0 && S_ISDIR(stb.st_mode)) \
|
||||
*blkp++ = SAVE(ptr)
|
||||
|
||||
DIRAPPEND(_PATH_BIN);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)csh.h 8.1 (Berkeley) 5/31/93
|
||||
* $Id: csh.h,v 1.7 1994/09/23 11:16:30 mycroft Exp $
|
||||
* $Id: csh.h,v 1.8 1995/01/30 19:37:25 mycroft Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -94,7 +94,7 @@ typedef void *ptr_t;
|
||||
#include <stdio.h>
|
||||
FILE *cshin, *cshout, *csherr;
|
||||
|
||||
#define isdir(d) ((d.st_mode & S_IFMT) == S_IFDIR)
|
||||
#define isdir(d) (S_ISDIR(d.st_mode))
|
||||
|
||||
typedef int bool;
|
||||
|
||||
|
@ -44,7 +44,7 @@ static char copyright[] =
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)df.c 8.7 (Berkeley) 4/2/94";*/
|
||||
static char rcsid[] = "$Id: df.c,v 1.17 1995/01/30 18:10:51 mycroft Exp $";
|
||||
static char rcsid[] = "$Id: df.c,v 1.18 1995/01/30 19:30:13 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -127,11 +127,11 @@ main(argc, argv)
|
||||
warn("%s", *argv);
|
||||
continue;
|
||||
}
|
||||
} else if ((stbuf.st_mode & S_IFMT) == S_IFCHR) {
|
||||
} else if (S_ISCHR(stbuf.st_mode)) {
|
||||
if (!ufs_df(*argv, &mntbuf[mntsize]))
|
||||
++mntsize;
|
||||
continue;
|
||||
} else if ((stbuf.st_mode & S_IFMT) == S_IFBLK) {
|
||||
} else if (S_ISBLK(stbuf.st_mode)) {
|
||||
if ((mntpt = getmntpt(*argv)) == 0) {
|
||||
mntpt = mktemp(strdup("/tmp/df.XXXXXX"));
|
||||
mdev.fspec = *argv;
|
||||
|
@ -39,7 +39,7 @@ char copyright[] =
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)rcp.c 5.32 (Berkeley) 2/25/91";*/
|
||||
static char rcsid[] = "$Id: rcp.c,v 1.6 1994/12/04 07:12:00 cgd Exp $";
|
||||
static char rcsid[] = "$Id: rcp.c,v 1.7 1995/01/30 19:37:34 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -407,7 +407,7 @@ verifydir(cp)
|
||||
struct stat stb;
|
||||
|
||||
if (stat(cp, &stb) >= 0) {
|
||||
if ((stb.st_mode & S_IFMT) == S_IFDIR)
|
||||
if (S_ISDIR(stb.st_mode))
|
||||
return;
|
||||
errno = ENOTDIR;
|
||||
}
|
||||
@ -493,7 +493,7 @@ source(argc, argv)
|
||||
}
|
||||
if (fstat(f, &stb) < 0)
|
||||
goto notreg;
|
||||
switch (stb.st_mode&S_IFMT) {
|
||||
switch (stb.st_mode & S_IFMT) {
|
||||
|
||||
case S_IFREG:
|
||||
break;
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)cd.c 8.1 (Berkeley) 5/31/93";*/
|
||||
static char *rcsid = "$Id: cd.c,v 1.10 1994/12/05 19:07:32 cgd Exp $";
|
||||
static char *rcsid = "$Id: cd.c,v 1.11 1995/01/30 19:38:04 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -99,8 +99,7 @@ cdcmd(argc, argv)
|
||||
if (*dest == '/' || (path = bltinlookup("CDPATH", 1)) == NULL)
|
||||
path = nullstr;
|
||||
while ((p = padvance(&path, dest)) != NULL) {
|
||||
if (stat(p, &statb) >= 0
|
||||
&& (statb.st_mode & S_IFMT) == S_IFDIR) {
|
||||
if (stat(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) {
|
||||
if (!print) {
|
||||
/*
|
||||
* XXX - rethink
|
||||
@ -186,7 +185,7 @@ top:
|
||||
STACKSTRNUL(p);
|
||||
if (lstat(stackblock(), &statb) < 0)
|
||||
error("lstat %s failed", stackblock());
|
||||
if ((statb.st_mode & S_IFMT) != S_IFLNK)
|
||||
if (!S_ISLNK(statb.st_mode))
|
||||
continue;
|
||||
|
||||
/* Hit a symbolic link. We have to start all over again. */
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)exec.c 8.1 (Berkeley) 5/31/93";*/
|
||||
static char *rcsid = "$Id: exec.c,v 1.13 1995/01/15 09:29:16 mycroft Exp $";
|
||||
static char *rcsid = "$Id: exec.c,v 1.14 1995/01/30 19:38:05 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -487,7 +487,7 @@ loop:
|
||||
goto loop;
|
||||
}
|
||||
e = EACCES; /* if we fail, this will be the error */
|
||||
if ((statb.st_mode & S_IFMT) != S_IFREG)
|
||||
if (!S_ISREG(statb.st_mode))
|
||||
goto loop;
|
||||
if (pathopt) { /* this is a %func directory */
|
||||
stalloc(strlen(fullname) + 1);
|
||||
|
Loading…
Reference in New Issue
Block a user