Use #if, not #ifdef with HAVE_ macros
authorJim Meyering <jim@meyering.net>
Sun, 15 Mar 1998 11:09:10 +0000 (11:09 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 15 Mar 1998 11:09:10 +0000 (11:09 +0000)
17 files changed:
lib/chown.c
lib/closeout.c
lib/dirname.c
lib/euidaccess.c
lib/fileblocks.c
lib/filemode.c
lib/ftruncate.c
lib/group-member.c
lib/isdir.c
lib/long-options.c
lib/mountlist.c
lib/path-concat.c
lib/save-cwd.c
lib/savedir.c
lib/strdup.c
lib/userspec.c
lib/yesno.c

index dc351d2..63b89c2 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
 
index a6fbbf7..a4a986f 100644 (file)
@@ -26,7 +26,7 @@
 # define _(Text) Text
 #endif
 
-#ifdef HAVE_STDLIB_H
+#if HAVE_STDLIB_H
 # include <stdlib.h>
 #endif
 #ifndef EXIT_FAILURE
index 7cc1040..56b66e6 100644 (file)
@@ -15,7 +15,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
index 4e032a9..4109d99 100644 (file)
@@ -21,7 +21,7 @@ Suite 330, Boston, MA 02111-1307, USA.  */
 /* Written by David MacKenzie and Torbjorn Granlund.
    Adapted for GNU C library by Roland McGrath.  */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
@@ -111,7 +111,7 @@ static gid_t egid;
 /* Nonzero if UID, GID, EUID, and EGID have valid values. */
 static int have_ids = 0;
 
-# ifdef HAVE_GETGROUPS
+# if HAVE_GETGROUPS
 int group_member ();
 # else
 #  define group_member(gid)    0
index e94d903..0c182d8 100644 (file)
@@ -17,7 +17,7 @@
 
 /* Written by Brian L. Matthews, blm@6sceng.UUCP. */
 \f
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
index 91373de..d87af5b 100644 (file)
@@ -1,5 +1,5 @@
 /* filemode.c -- make a string describing file modes
-   Copyright (C) 1985, 1990, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1990, 1993, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 \f
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
 #endif
 
 #include <sys/types.h>
 #endif
 
 #ifdef STAT_MACROS_BROKEN
-#undef S_ISBLK
-#undef S_ISCHR
-#undef S_ISDIR
-#undef S_ISFIFO
-#undef S_ISLNK
-#undef S_ISMPB
-#undef S_ISMPC
-#undef S_ISNWK
-#undef S_ISREG
-#undef S_ISSOCK
+# undef S_ISBLK
+# undef S_ISCHR
+# undef S_ISDIR
+# undef S_ISFIFO
+# undef S_ISLNK
+# undef S_ISMPB
+# undef S_ISMPC
+# undef S_ISNWK
+# undef S_ISREG
+# undef S_ISSOCK
 #endif /* STAT_MACROS_BROKEN.  */
 
 #if !defined(S_ISBLK) && defined(S_IFBLK)
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
 #endif
 #if !defined(S_ISCHR) && defined(S_IFCHR)
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
 #endif
 #if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
 #endif
 #if !defined(S_ISREG) && defined(S_IFREG)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
 #endif
 #if !defined(S_ISFIFO) && defined(S_IFIFO)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
 #endif
 #if !defined(S_ISLNK) && defined(S_IFLNK)
-#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
 #endif
 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
-#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
 #endif
 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
-#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
+# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
+# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
 #endif
 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
-#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
+# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
 #endif
 
 void mode_string ();
index 1272ee7..d4c129a 100644 (file)
@@ -1,8 +1,8 @@
 /* ftruncate emulations that work on some System V's.
    This file is in the public domain.  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
 #endif
 
 #include <sys/types.h>
@@ -19,15 +19,15 @@ ftruncate (fd, length)
 }
 
 #else /* not F_CHSIZE */
-#ifdef F_FREESP
+# ifdef F_FREESP
 
 /* By William Kucharski <kucharsk@netcom.com>.  */
 
-#include <sys/stat.h>
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#  include <sys/stat.h>
+#  include <errno.h>
+#  if HAVE_UNISTD_H
+#   include <unistd.h>
+#  endif
 
 int
 ftruncate (fd, length)
@@ -71,8 +71,8 @@ ftruncate (fd, length)
   return 0;
 }
 
-#else /* not F_CHSIZE nor F_FREESP */
-#ifdef HAVE_CHSIZE
+# else /* not F_CHSIZE nor F_FREESP */
+#  if HAVE_CHSIZE
 
 int
 ftruncate (fd, length)
@@ -82,12 +82,12 @@ ftruncate (fd, length)
   return chsize (fd, length);
 }
 
-#else /* not F_CHSIZE nor F_FREESP nor HAVE_CHSIZE */
+#  else /* not F_CHSIZE nor F_FREESP nor HAVE_CHSIZE */
 
-#include <errno.h>
-#ifndef errno
+#   include <errno.h>
+#   ifndef errno
 extern int errno;
-#endif
+#   endif
 
 int
 ftruncate (fd, length)
@@ -98,6 +98,6 @@ ftruncate (fd, length)
   return -1;
 }
 
-#endif /* not HAVE_CHSIZE */
-#endif /* not F_FREESP */
+#  endif /* not HAVE_CHSIZE */
+# endif /* not F_FREESP */
 #endif /* not F_CHSIZE */
index 065f4d8..dee0c39 100644 (file)
@@ -1,5 +1,5 @@
 /* group-member.c -- determine whether group id is in calling user's group list
-   Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
@@ -26,7 +26,7 @@
 # include <stdlib.h>
 #endif
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
 
@@ -41,7 +41,7 @@ struct group_info
     GETGROUPS_T *group;
   };
 
-#ifdef HAVE_GETGROUPS
+#if HAVE_GETGROUPS
 
 static void
 free_group_info (struct group_info *g)
index 4283346..f653faf 100644 (file)
@@ -1,5 +1,5 @@
 /* isdir.c -- determine whether a directory exists
-   Copyright (C) 1990 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
 #endif
 
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #ifdef STAT_MACROS_BROKEN
-#undef S_ISDIR
+# undef S_ISDIR
 #endif /* STAT_MACROS_BROKEN.  */
 
 #if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
 #endif
 
 /* If PATH is an existing directory or symbolic link to a directory,
index 40c1a0d..4d216ab 100644 (file)
@@ -17,7 +17,7 @@
 
 /* Written by Jim Meyering.  */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
index 5018745..68a07cb 100644 (file)
@@ -1,5 +1,5 @@
 /* mountlist.c -- return a list of mounted filesystems
-   Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
@@ -42,7 +42,7 @@ char *xrealloc ();
 char *xstrdup ();
 void error ();
 
-#ifdef HAVE_SYS_PARAM_H
+#if HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
 
@@ -101,7 +101,7 @@ void error ();
 # define MOUNTED_GETMNTTBL
 #endif
 
-#ifdef HAVE_SYS_MNTENT_H
+#if HAVE_SYS_MNTENT_H
 /* This is to get MNTOPT_IGNORE on e.g. SVR4.  */
 # include <sys/mntent.h>
 #endif
index b0c18a8..abafd31 100644 (file)
@@ -1,5 +1,5 @@
 /* path-concat.c -- concatenate two arbitrary pathnames
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 
 /* Written by Jim Meyering.  */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
@@ -26,7 +26,7 @@
 #endif
 
 #include <stdio.h>
-#ifdef HAVE_STRING_H
+#if HAVE_STRING_H
 # include <string.h>
 #endif
 #include <sys/types.h>
index 31b46ce..40bd70b 100644 (file)
@@ -1,5 +1,5 @@
 /* save-cwd.c -- Save and restore current working directory.
-   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 
 /* Written by Jim Meyering <meyering@na-net.ornl.gov>.  */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include "config.h"
 #endif
 
 # include <stdlib.h>
 #endif
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
 
-#ifdef HAVE_FCNTL_H
+#if HAVE_FCNTL_H
 # include <fcntl.h>
 #else
 # include <sys/file.h>
@@ -67,7 +67,7 @@ save_cwd (cwd)
 
   if (have_working_fchdir)
     {
-#ifdef HAVE_FCHDIR
+#if HAVE_FCHDIR
       cwd->desc = open (".", O_RDONLY);
       if (cwd->desc < 0)
        {
index 523e94e..5a9c339 100644 (file)
@@ -1,5 +1,5 @@
 /* savedir.c -- save the list of files in a directory in a string
-   Copyright (C) 1990, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
 #include <sys/types.h>
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
 
index 7b73a50..4f6bb83 100644 (file)
@@ -1,5 +1,5 @@
 /* strdup.c -- return a newly allocated copy of a string
-   Copyright (C) 1990 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
 #endif
 
 #ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
+# include <string.h>
+# include <stdlib.h>
 #else
 char *malloc ();
 char *strcpy ();
index bf51778..e73bee9 100644 (file)
@@ -1,5 +1,5 @@
 /* userspec.c -- Parse a user and group string.
-   Copyright (C) 1989, 1990, 1991, 1992, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1990, 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
 #ifdef __GNUC__
 # define alloca __builtin_alloca
 #else
-# ifdef HAVE_ALLOCA_H
+# if HAVE_ALLOCA_H
 #  include <alloca.h>
 # else
 #  ifdef _AIX
index 44c437c..8aaaf3d 100644 (file)
@@ -1,5 +1,5 @@
 /* yesno.c -- read a yes/no response from stdin
-   Copyright (C) 1990 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1998 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
 #endif
 
 #include <ctype.h>
-#ifdef HAVE_STDLIB_H
+#if HAVE_STDLIB_H
 # include <stdlib.h>
 #endif
 #include <stdio.h>