Use S_IS*(), not S_IF*.

This commit is contained in:
mycroft 1997-10-19 19:27:40 +00:00
parent c2418895f6
commit 004f255040
7 changed files with 23 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aux.c,v 1.7 1997/10/19 13:48:21 mycroft Exp $ */
/* $NetBSD: aux.c,v 1.8 1997/10/19 19:27:40 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)aux.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: aux.c,v 1.7 1997/10/19 13:48:21 mycroft Exp $");
__RCSID("$NetBSD: aux.c,v 1.8 1997/10/19 19:27:40 mycroft Exp $");
#endif
#endif /* not lint */
@ -115,7 +115,7 @@ isdir(name)
if (stat(name, &sbuf) < 0)
return(0);
return((sbuf.st_mode & S_IFMT) == S_IFDIR);
return (S_ISDIR(sbuf.st_mode));
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: collect.c,v 1.11 1997/10/19 05:03:10 lukem Exp $ */
/* $NetBSD: collect.c,v 1.12 1997/10/19 19:29:06 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)collect.c 8.2 (Berkeley) 4/19/94";
#else
__RCSID("$NetBSD: collect.c,v 1.11 1997/10/19 05:03:10 lukem Exp $");
__RCSID("$NetBSD: collect.c,v 1.12 1997/10/19 19:29:06 mycroft Exp $");
#endif
#endif /* not lint */
@ -432,7 +432,7 @@ exwrite(name, fp, f)
printf("\"%s\" ", name);
fflush(stdout);
}
if (stat(name, &junk) >= 0 && (junk.st_mode & S_IFMT) == S_IFREG) {
if (stat(name, &junk) >= 0 && S_ISREG(junk.st_mode)) {
if (!f)
fprintf(stderr, "%s: ", name);
fprintf(stderr, "File exists\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.9 1997/10/19 14:25:24 mycroft Exp $ */
/* $NetBSD: defs.h,v 1.10 1997/10/19 19:31:16 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@ -101,8 +101,6 @@
#define INSERT 1
#define REPLACE 2
#define ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define ALLOC(x) (struct x *) malloc(sizeof(struct x))
struct namelist { /* for making lists of strings */

View File

@ -1,4 +1,4 @@
/* $NetBSD: expand.c,v 1.10 1997/10/19 13:58:56 lukem Exp $ */
/* $NetBSD: expand.c,v 1.11 1997/10/19 19:31:19 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.1 (Berkeley) 6/9/93";
#else
__RCSID("$NetBSD: expand.c,v 1.10 1997/10/19 13:58:56 lukem Exp $");
__RCSID("$NetBSD: expand.c,v 1.11 1997/10/19 19:31:19 mycroft Exp $");
#endif
#endif /* not lint */
@ -319,7 +319,7 @@ matchdir(pattern)
}
if (fstat(dirp->dd_fd, &stb) < 0)
goto patherr1;
if (!ISDIR(stb.st_mode)) {
if (!S_ISDIR(stb.st_mode)) {
errno = ENOTDIR;
goto patherr1;
}
@ -516,7 +516,7 @@ slash:
while (*s)
addpath(*s++);
addpath('/');
if (stat(path, &stb) == 0 && ISDIR(stb.st_mode))
if (stat(path, &stb) == 0 && S_ISDIR(stb.st_mode))
if (*p == '\0') {
if (which & E_TILDE)
Cat(path, "");

View File

@ -1,4 +1,4 @@
/* $NetBSD: wc.c,v 1.11 1997/10/18 16:48:39 mrg Exp $ */
/* $NetBSD: wc.c,v 1.12 1997/10/19 19:33:37 mycroft Exp $ */
/*
* Copyright (c) 1980, 1987, 1991, 1993
@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)wc.c 8.2 (Berkeley) 5/2/95";
#else
static char rcsid[] = "$NetBSD: wc.c,v 1.11 1997/10/18 16:48:39 mrg Exp $";
static char rcsid[] = "$NetBSD: wc.c,v 1.12 1997/10/19 19:33:37 mycroft Exp $";
#endif
#endif /* not lint */
@ -175,15 +175,13 @@ cnt(file)
* of inode.
*/
else if (dochar) {
int ifmt;
if (fstat(fd, &sb)) {
warn("%s", file);
rval = 1;
} else {
ifmt = sb.st_mode & S_IFMT;
if (ifmt == S_IFREG || ifmt == S_IFLNK
|| ifmt == S_IFDIR) {
if (S_ISREG(sb.st_mode) ||
S_ISLNK(sb.st_mode) ||
S_ISDIR(sb.st_mode)) {
charct = sb.st_size;
} else {
while ((len = read(fd, buf, MAXBSIZE)) > 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: xlint.c,v 1.4 1996/12/22 11:31:47 cgd Exp $ */
/* $NetBSD: xlint.c,v 1.5 1997/10/19 19:34:56 mycroft Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -33,7 +33,7 @@
*/
#ifndef lint
static char rcsid[] = "$NetBSD: xlint.c,v 1.4 1996/12/22 11:31:47 cgd Exp $";
static char rcsid[] = "$NetBSD: xlint.c,v 1.5 1997/10/19 19:34:56 mycroft Exp $";
#endif
#include <sys/param.h>
@ -699,7 +699,7 @@ rdok(path)
if (stat(path, &sbuf) == -1)
return (0);
if ((sbuf.st_mode & S_IFMT) != S_IFREG)
if (!S_ISREG(sbuf.st_mode))
return (0);
if (access(path, R_OK) == -1)
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.4 1997/03/13 06:19:19 mikel Exp $ */
/* $NetBSD: misc.c,v 1.5 1997/10/19 19:37:31 mycroft Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@ -19,7 +19,7 @@
#if !defined(lint) && !defined(LINT)
/*static char rcsid[] = "Id: misc.c,v 2.9 1994/01/15 20:43:43 vixie Exp";*/
static char rcsid[] = "$NetBSD: misc.c,v 1.4 1997/03/13 06:19:19 mikel Exp $";
static char rcsid[] = "$NetBSD: misc.c,v 1.5 1997/10/19 19:37:31 mycroft Exp $";
#endif
/* vix 26jan87 [RCS has the rest of the log]
@ -208,7 +208,7 @@ set_cron_cwd()
exit(ERROR_EXIT);
}
}
if (!(sb.st_mode & S_IFDIR)) {
if (!S_ISDIR(sb.st_mode)) {
fprintf(stderr, "'%s' is not a directory, bailing out.\n",
CRONDIR);
exit(ERROR_EXIT);
@ -232,7 +232,7 @@ set_cron_cwd()
exit(ERROR_EXIT);
}
}
if (!(sb.st_mode & S_IFDIR)) {
if (!S_ISDIR(sb.st_mode)) {
fprintf(stderr, "'%s' is not a directory, bailing out.\n",
SPOOL_DIR);
exit(ERROR_EXIT);