summaryrefslogtreecommitdiff
path: root/utils/lndir
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-04-21 09:16:48 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-28 22:35:04 -0400
commit945c45ad50ed31e3acb96fdaafb21640c4669f12 (patch)
treeae2e59ba8d3a49bbd3c3dcece39d53aef691ed44 /utils/lndir
parente5b3492f23c2296d0d8221e1787ee585331f726e (diff)
downloadhaskell-945c45ad50ed31e3acb96fdaafb21640c4669f12.tar.gz
Prefer #if defined to #ifdef
Our new CPP linter enforces this.
Diffstat (limited to 'utils/lndir')
-rw-r--r--utils/lndir/lndir-Xos.h30
-rw-r--r--utils/lndir/lndir-Xosdefs.h32
-rw-r--r--utils/lndir/lndir.c40
3 files changed, 51 insertions, 51 deletions
diff --git a/utils/lndir/lndir-Xos.h b/utils/lndir/lndir-Xos.h
index c6d1e3652c..b423f6b641 100644
--- a/utils/lndir/lndir-Xos.h
+++ b/utils/lndir/lndir-Xos.h
@@ -29,9 +29,9 @@
* Get major data types (esp. caddr_t)
*/
-#ifdef USG
-#ifndef __TYPES__
-#ifdef CRAY
+#if defined(USG)
+#if !defined(__TYPES__)
+#if defined(CRAY)
#define word word_t
#endif /* CRAY */
#include <sys/types.h> /* forgot to protect it... */
@@ -54,12 +54,12 @@
* need to have #defines here.
*/
-#ifndef X_NOT_STDC_ENV
+#if !defined(X_NOT_STDC_ENV)
#include <string.h>
#define index strchr
#define rindex strrchr
#else
-#ifdef SYSV
+#if defined(SYSV)
#include <string.h>
#define index strchr
#define rindex strrchr
@@ -74,18 +74,18 @@
/*
* Get open(2) constants
*/
-#ifdef X_NOT_POSIX
+#if defined(X_NOT_POSIX)
#include <fcntl.h>
-#ifdef USL
+#if defined(USL)
#include <unistd.h>
#endif /* USL */
-#ifdef CRAY
+#if defined(CRAY)
#include <unistd.h>
#endif /* CRAY */
-#ifdef MOTOROLA
+#if defined(MOTOROLA)
#include <unistd.h>
#endif /* MOTOROLA */
-#ifdef SYSV386
+#if defined(SYSV386)
#include <unistd.h>
#endif /* SYSV386 */
#include <sys/file.h>
@@ -104,13 +104,13 @@
* Get struct timeval
*/
-#ifdef SYSV
+#if defined(SYSV)
-#ifndef USL
+#if !defined(USL)
#include <sys/time.h>
#endif
#include <time.h>
-#ifdef CRAY
+#if defined(CRAY)
#undef word
#endif /* CRAY */
#if defined(USG) && !defined(CRAY) && !defined(MOTOROLA)
@@ -118,7 +118,7 @@ struct timeval {
long tv_sec;
long tv_usec;
};
-#ifndef USL_SHARELIB
+#if !defined(USL_SHARELIB)
struct timezone {
int tz_minuteswest;
int tz_dsttime;
@@ -144,6 +144,6 @@ struct timezone {
#define SIGCHLD SIGCLD
#endif
-#ifdef ISC
+#if defined(ISC)
#include <sys/bsdtypes.h>
#endif
diff --git a/utils/lndir/lndir-Xosdefs.h b/utils/lndir/lndir-Xosdefs.h
index 7e232c97c5..09658937ad 100644
--- a/utils/lndir/lndir-Xosdefs.h
+++ b/utils/lndir/lndir-Xosdefs.h
@@ -34,63 +34,63 @@
* You may still have to define _POSIX_SOURCE to get it.
*/
-#ifdef NOSTDHDRS
+#if defined(NOSTDHDRS)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
-#ifdef NeXT
+#if defined(NeXT)
#define X_NOT_POSIX
#endif
-#ifdef sony
-#ifndef SYSTYPE_SYSV
+#if defined(sony)
+#if !defined(SYSTYPE_SYSV)
#define X_NOT_POSIX
#endif
#endif
-#ifdef UTEK
+#if defined(UTEK)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
-#ifdef CRAY
+#if defined(CRAY)
#define X_NOT_POSIX
#endif
-#ifdef vax
-#ifndef ultrix /* assume vanilla BSD */
+#if defined(vax)
+#if !defined(ultrix) /* assume vanilla BSD */
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
#endif
-#ifdef luna
+#if defined(luna)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
-#ifdef Mips
+#if defined(Mips)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
-#ifdef USL
-#ifdef SYSV /* (release 3.2) */
+#if defined(USL)
+#if defined(SYSV) /* (release 3.2) */
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
#endif
-#ifdef SYSV386
-#ifdef SYSV
+#if defined(SYSV386)
+#if defined(SYSV)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
#endif
-#ifdef MOTOROLA
-#ifdef SYSV
+#if defined(MOTOROLA)
+#if defined(SYSV)
#define X_NOT_STDC_ENV
#endif
#endif
diff --git a/utils/lndir/lndir.c b/utils/lndir/lndir.c
index 8269f6ec9e..87f2824166 100644
--- a/utils/lndir/lndir.c
+++ b/utils/lndir/lndir.c
@@ -52,27 +52,27 @@ in this Software without prior written authorization from the X Consortium.
#include <sys/param.h>
#include <errno.h>
-#ifndef X_NOT_POSIX
+#if !defined(X_NOT_POSIX)
#include <dirent.h>
#else
-#ifdef SYSV
+#if defined(SYSV)
#include <dirent.h>
#else
-#ifdef USG
+#if defined(USG)
#include <dirent.h>
#else
#include <sys/dir.h>
-#ifndef dirent
+#if !defined(dirent)
#define dirent direct
#endif
#endif
#endif
#endif
-#ifndef MAXPATHLEN
+#if !defined(MAXPATHLEN)
#define MAXPATHLEN 2048
#endif
-#ifdef __CYGWIN32__
+#if defined(__CYGWIN32__)
#include <sys/cygwin.h>
#endif
@@ -80,7 +80,7 @@ in this Software without prior written authorization from the X Consortium.
#include <stdarg.h>
#endif
-#ifdef X_NOT_STDC_ENV
+#if defined(X_NOT_STDC_ENV)
extern int errno;
#endif
int silent = 0; /* -silent */
@@ -92,13 +92,13 @@ char *curdir;
int force=0;
-#ifdef WIN32
+#if defined(WIN32)
#define mymkdir(X, Y) mkdir(X)
#else
#define mymkdir(X, Y) mkdir(X, Y)
#endif
-#ifndef WIN32
+#if !defined(WIN32)
#define SYMLINKS
#define BELIEVE_ST_NLINK
#endif
@@ -177,7 +177,7 @@ int copyfile(const char *oldpath, const char *newpath) {
ssize_t s;
char buf[BUFSIZE];
-#ifdef SYMLINKS
+#if defined(SYMLINKS)
if (copy == 0) {
return symlink(oldpath, newpath);
} else {
@@ -217,7 +217,7 @@ int copyfile(const char *oldpath, const char *newpath) {
}
fclose(f_old);
return 0;
-#ifdef SYMLINKS
+#if defined(SYMLINKS)
}
#endif
}
@@ -289,7 +289,7 @@ int rel; /* if true, prepend "../" to fn before using */
strcpy (p, dp->d_name);
if (
-#ifdef BELIEVE_ST_NLINK
+#if defined(BELIEVE_ST_NLINK)
n_dirs > 0
#else
/* st_nlink is 1 on Windows, so we have to keep looking for
@@ -302,14 +302,14 @@ int rel; /* if true, prepend "../" to fn before using */
continue;
}
-#ifdef S_ISDIR
+#if defined(S_ISDIR)
if(S_ISDIR(sb.st_mode))
#else
if (sb.st_mode & S_IFDIR)
#endif
{
/* directory */
-#ifndef __CYGWIN32__ /* don't trust cygwin's n_dirs count */
+#if !defined(__CYGWIN32__) /* don't trust cygwin's n_dirs count */
n_dirs--;
#endif
if (dp->d_name[0] == '.' &&
@@ -343,7 +343,7 @@ int rel; /* if true, prepend "../" to fn before using */
continue;
}
}
-#ifdef SYMLINKS
+#if defined(SYMLINKS)
if (readlink (dp->d_name, symbuf, sizeof(symbuf) - 1) >= 0) {
msg ("%s: is a link instead of a directory", dp->d_name);
curdir = rcurdir = ocurdir;
@@ -365,7 +365,7 @@ int rel; /* if true, prepend "../" to fn before using */
}
/* non-directory */
-#ifdef SYMLINKS
+#if defined(SYMLINKS)
symlen = readlink (dp->d_name, symbuf, sizeof(symbuf) - 1);
if (symlen >= 0)
symbuf[symlen] = '\0';
@@ -409,7 +409,7 @@ char **av;
char *prog_name = av[0];
char* tn;
struct stat fs, ts;
-#ifdef __CYGWIN32__
+#if defined(__CYGWIN32__)
/*
The lndir code assumes unix-style paths to work. cygwin
lets you get away with using dos'ish paths (e.g., "f:/oo")
@@ -442,7 +442,7 @@ char **av;
quit (1, "usage: %s [-f] [-silent] [-ignorelinks] fromdir [todir]",
prog_name);
-#ifdef __CYGWIN32__
+#if defined(__CYGWIN32__)
cygwin_conv_to_full_posix_path(av[0], fn);
#else
fn = av[0];
@@ -460,7 +460,7 @@ char **av;
}
else {
quiterr (1, tn);
-#ifdef S_ISDIR
+#if defined(S_ISDIR)
if (!(S_ISDIR(ts.st_mode)))
#else
if (!(ts.st_mode & S_IFDIR))
@@ -474,7 +474,7 @@ char **av;
/* from directory */
if (stat (fn, &fs) < 0)
quiterr (1, fn);
-#ifdef S_ISDIR
+#if defined(S_ISDIR)
if (!(S_ISDIR(fs.st_mode)))
#else
if (!(fs.st_mode & S_IFDIR))