changeset 1278:9ad625a30b7d

Use #if, not #ifdef with HAVE_ macros
author Jim Meyering <jim@meyering.net>
date Sun, 15 Mar 1998 11:09:10 +0000
parents f44ecdf80197
children 764d4b8d4636
files 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
diffstat 17 files changed, 81 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/lib/chown.c
+++ b/lib/chown.c
@@ -27,7 +27,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
 
--- a/lib/closeout.c
+++ b/lib/closeout.c
@@ -26,7 +26,7 @@
 # define _(Text) Text
 #endif
 
-#ifdef HAVE_STDLIB_H
+#if HAVE_STDLIB_H
 # include <stdlib.h>
 #endif
 #ifndef EXIT_FAILURE
--- a/lib/dirname.c
+++ b/lib/dirname.c
@@ -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
 
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -21,7 +21,7 @@
 /* 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 @@
 /* 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
--- a/lib/fileblocks.c
+++ b/lib/fileblocks.c
@@ -17,7 +17,7 @@
 
 /* Written by Brian L. Matthews, blm@6sceng.UUCP. */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
--- a/lib/filemode.c
+++ b/lib/filemode.c
@@ -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.  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
 #endif
 
 #include <sys/types.h>
@@ -47,45 +47,45 @@
 #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 ();
--- a/lib/ftruncate.c
+++ b/lib/ftruncate.c
@@ -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 @@
 }
 
 #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 @@
   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 @@
   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 @@
   return -1;
 }
 
-#endif /* not HAVE_CHSIZE */
-#endif /* not F_FREESP */
+#  endif /* not HAVE_CHSIZE */
+# endif /* not F_FREESP */
 #endif /* not F_CHSIZE */
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -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 @@
     GETGROUPS_T *group;
   };
 
-#ifdef HAVE_GETGROUPS
+#if HAVE_GETGROUPS
 
 static void
 free_group_info (struct group_info *g)
--- a/lib/isdir.c
+++ b/lib/isdir.c
@@ -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
@@ -15,19 +15,19 @@
    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,
--- a/lib/long-options.c
+++ b/lib/long-options.c
@@ -17,7 +17,7 @@
 
 /* Written by Jim Meyering.  */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -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 *xstrdup ();
 void error ();
 
-#ifdef HAVE_SYS_PARAM_H
+#if HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
 
@@ -101,7 +101,7 @@
 # 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
--- a/lib/path-concat.c
+++ b/lib/path-concat.c
@@ -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>
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -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
 
@@ -27,11 +27,11 @@
 # 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 @@
 
   if (have_working_fchdir)
     {
-#ifdef HAVE_FCHDIR
+#if HAVE_FCHDIR
       cwd->desc = open (".", O_RDONLY);
       if (cwd->desc < 0)
 	{
--- a/lib/savedir.c
+++ b/lib/savedir.c
@@ -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
@@ -17,13 +17,13 @@
 
 /* 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
 
--- a/lib/strdup.c
+++ b/lib/strdup.c
@@ -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
@@ -15,13 +15,13 @@
    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 ();
--- a/lib/userspec.c
+++ b/lib/userspec.c
@@ -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
--- a/lib/yesno.c
+++ b/lib/yesno.c
@@ -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
@@ -15,12 +15,12 @@
    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>