bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

removed most uses of _POSIX_VERSION


From: Paul Eggert
Subject: removed most uses of _POSIX_VERSION
Date: Mon, 30 May 2005 00:36:30 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

I noticed that _POSIX_VERSION was protecting a lot of old cruft that
isn't needed any more, so I installed this:

2005-05-29  Paul Eggert  <address@hidden>

        * lib/euidaccess.c (getuid, getgid, getuid, getegid)
        [!defined _POSIX_VERSION]: Remove decls; not needed these days.
        * lib/idcache.c (getpwuid, getpwnam, getgrgid, getgrnam)
        [!defined _POSIX_VERSION]: Remove decls; not needed these days.
        * lib/pathmax.h: Include <limits.h> unconditionally, since other
        files have been getting away with it for years (MORE/BSD 4.3
        is extinct now).
        * lib/userspec.c (getpwnam, getgrnam, getgrgid)
        [!defined _POSIX_VERSION]: Remove decls; not needed these days.
        * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
        * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
        Remove decls.
        * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
        * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
        [!defined _POSIX_VERSION]: Remove decls.
        * src/install.c (getpwnam, getgrnam): Remove decl.
        (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
        * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
        (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
        * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
        * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
        isn't defined.
        Don't include <sys/file.h>; no longer needed.
        (getegid, geteuid): Remove no-longer-necessary decls.

Index: lib/euidaccess.c
===================================================================
RCS file: /fetish/cu/lib/euidaccess.c,v
retrieving revision 1.20
diff -p -u -r1.20 euidaccess.c
--- lib/euidaccess.c    14 May 2005 07:58:06 -0000      1.20
+++ lib/euidaccess.c    30 May 2005 07:21:32 -0000
@@ -1,6 +1,6 @@
 /* euidaccess -- check if effective user id can access file
 
-   Copyright (C) 1990, 1991, 1995, 1998, 2000, 2003, 2004 Free
+   Copyright (C) 1990, 1991, 1995, 1998, 2000, 2003, 2004, 2005 Free
    Software Foundation, Inc.
 
    This file is part of the GNU C Library.
@@ -41,13 +41,6 @@
 # include <libgen.h>
 #endif
 
-#ifndef _POSIX_VERSION
-uid_t getuid ();
-gid_t getgid ();
-uid_t geteuid ();
-gid_t getegid ();
-#endif
-
 #include <errno.h>
 #ifndef __set_errno
 # define __set_errno(val) errno = (val)
Index: lib/idcache.c
===================================================================
RCS file: /fetish/cu/lib/idcache.c,v
retrieving revision 1.13
diff -p -u -r1.13 idcache.c
--- lib/idcache.c       14 May 2005 07:58:06 -0000      1.13
+++ lib/idcache.c       30 May 2005 07:21:32 -0000
@@ -1,6 +1,7 @@
 /* idcache.c -- map user and group IDs, cached for speed
-   Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998, 2003 Free Software
-   Foundation, Inc.
+
+   Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998, 2003, 2005 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
@@ -32,13 +33,6 @@
 
 #include "xalloc.h"
 
-#ifndef _POSIX_VERSION
-struct passwd *getpwuid ();
-struct passwd *getpwnam ();
-struct group *getgrgid ();
-struct group *getgrnam ();
-#endif
-
 #ifdef __DJGPP__
 static char digits[] = "0123456789";
 #endif
Index: lib/pathmax.h
===================================================================
RCS file: /fetish/cu/lib/pathmax.h,v
retrieving revision 1.11
diff -p -u -r1.11 pathmax.h
--- lib/pathmax.h       30 May 2005 07:05:07 -0000      1.11
+++ lib/pathmax.h       30 May 2005 07:21:32 -0000
@@ -22,12 +22,7 @@
 #  include <unistd.h>
 # endif
 
-/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
-   PATH_MAX but might cause redefinition warnings when sys/param.h is
-   later included (as on MORE/BSD 4.3).  */
-# if defined _POSIX_VERSION || !defined __GNUC__
-#  include <limits.h>
-# endif
+# include <limits.h>
 
 # ifndef _POSIX_PATH_MAX
 #  define _POSIX_PATH_MAX 256
Index: lib/userspec.c
===================================================================
RCS file: /fetish/cu/lib/userspec.c,v
retrieving revision 1.47
diff -p -u -r1.47 userspec.c
--- lib/userspec.c      14 May 2005 07:58:07 -0000      1.47
+++ lib/userspec.c      30 May 2005 07:21:32 -0000
@@ -53,12 +53,6 @@
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
 
-#ifndef _POSIX_VERSION
-struct passwd *getpwnam ();
-struct group *getgrnam ();
-struct group *getgrgid ();
-#endif
-
 #ifndef HAVE_ENDGRENT
 # define endgrent() ((void) 0)
 #endif
Index: src/chgrp.c
===================================================================
RCS file: /fetish/cu/src/chgrp.c,v
retrieving revision 1.119
diff -p -u -r1.119 chgrp.c
--- src/chgrp.c 14 May 2005 07:58:36 -0000      1.119
+++ src/chgrp.c 30 May 2005 07:21:32 -0000
@@ -37,10 +37,6 @@
 
 #define AUTHORS "David MacKenzie", "Jim Meyering"
 
-#ifndef _POSIX_VERSION
-struct group *getgrnam ();
-#endif
-
 #if ! HAVE_ENDGRENT
 # define endgrent() ((void) 0)
 #endif
Index: src/chown-core.c
===================================================================
RCS file: /fetish/cu/src/chown-core.c,v
retrieving revision 1.36
diff -p -u -r1.36 chown-core.c
--- src/chown-core.c    14 May 2005 07:58:36 -0000      1.36
+++ src/chown-core.c    30 May 2005 07:21:32 -0000
@@ -32,11 +32,6 @@
 #include "root-dev-ino.h"
 #include "xfts.h"
 
-#ifndef _POSIX_VERSION
-struct group *getgrnam ();
-struct group *getgrgid ();
-#endif
-
 enum RCH_status
   {
     /* we called fchown and close, and both succeeded */
Index: src/cp.c
===================================================================
RCS file: /fetish/cu/src/cp.c,v
retrieving revision 1.208
diff -p -u -r1.208 cp.c
--- src/cp.c    14 May 2005 07:58:36 -0000      1.208
+++ src/cp.c    30 May 2005 07:21:32 -0000
@@ -50,10 +50,6 @@
 
 #define AUTHORS "Torbjorn Granlund", "David MacKenzie", "Jim Meyering"
 
-#ifndef _POSIX_VERSION
-uid_t geteuid ();
-#endif
-
 /* Used by do_copy, make_path_private, and re_protect
    to keep a list of leading directories whose protections
    need to be fixed after copying. */
Index: src/id.c
===================================================================
RCS file: /fetish/cu/src/id.c,v
retrieving revision 1.84
diff -p -u -r1.84 id.c
--- src/id.c    14 May 2005 07:58:37 -0000      1.84
+++ src/id.c    30 May 2005 07:21:32 -0000
@@ -35,15 +35,6 @@
 
 #define AUTHORS "Arnold Robbins", "David MacKenzie"
 
-#ifndef _POSIX_VERSION
-struct passwd *getpwuid ();
-struct group *getgrgid ();
-uid_t getuid ();
-gid_t getgid ();
-uid_t geteuid ();
-gid_t getegid ();
-#endif /* not _POSIX_VERSION */
-
 int getugroups ();
 
 static void print_user (uid_t uid);
Index: src/install.c
===================================================================
RCS file: /fetish/cu/src/install.c,v
retrieving revision 1.176
diff -p -u -r1.176 install.c
--- src/install.c       14 May 2005 07:58:37 -0000      1.176
+++ src/install.c       30 May 2005 07:21:32 -0000
@@ -1,5 +1,5 @@
 /* install - copy files and set attributes
-   Copyright (C) 89, 90, 91, 1995-2004 Free Software Foundation, Inc.
+   Copyright (C) 89, 90, 91, 1995-2005 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
@@ -47,14 +47,6 @@
 # include <sys/wait.h>
 #endif
 
-struct passwd *getpwnam ();
-struct group *getgrnam ();
-
-#ifndef _POSIX_VERSION
-uid_t getuid ();
-gid_t getgid ();
-#endif
-
 #if ! HAVE_ENDGRENT
 # define endgrent() ((void) 0)
 #endif
Index: src/md5sum.c
===================================================================
RCS file: /fetish/cu/src/md5sum.c,v
retrieving revision 1.134
diff -p -u -r1.134 md5sum.c
--- src/md5sum.c        14 May 2005 07:58:37 -0000      1.134
+++ src/md5sum.c        30 May 2005 07:21:32 -0000
@@ -37,29 +37,6 @@
 
 #define AUTHORS "Ulrich Drepper", "Scott Miller"
 
-/* Most systems do not distinguish between external and internal
-   text representations.  */
-/* FIXME: This begs for an autoconf test.  */
-#if O_BINARY
-# define OPENOPTS(BINARY) ((BINARY) ? TEXT1TO1 : TEXTCNVT)
-# define TEXT1TO1 "rb"
-# define TEXTCNVT "r"
-#else
-# if defined VMS
-#  define OPENOPTS(BINARY) ((BINARY) ? TEXT1TO1 : TEXTCNVT)
-#  define TEXT1TO1 "rb", "ctx=stm"
-#  define TEXTCNVT "r", "ctx=stm"
-# else
-#  if UNIX || __UNIX__ || unix || __unix__ || _POSIX_VERSION
-#   define OPENOPTS(BINARY) "r"
-#  else
-    /* The following line is intended to evoke an error.
-       Using #error is not portable enough.  */
-    "Cannot determine system type."
-#  endif
-# endif
-#endif
-
 
 #define DIGEST_TYPE_STRING(Alg) ((Alg) == ALG_MD5 ? "MD5" : "SHA1")
 #define DIGEST_STREAM(Alg) ((Alg) == ALG_MD5 ? md5_stream : sha1_stream)
@@ -354,7 +331,7 @@ digest_file (const char *filename, bool 
         Some systems distinguish between internal and
         external text representations.  */
 
-      fp = fopen (filename, OPENOPTS (binary));
+      fp = fopen (filename, (O_BINARY && binary ? "rb" : "r"));
       if (fp == NULL)
        {
          error (0, errno, "%s", filename);
Index: src/system.h
===================================================================
RCS file: /fetish/cu/src/system.h,v
retrieving revision 1.118
diff -p -u -r1.118 system.h
--- src/system.h        14 May 2005 07:58:37 -0000      1.118
+++ src/system.h        30 May 2005 07:21:32 -0000
@@ -35,8 +35,6 @@ you must include <sys/types.h> before in
 # include <sys/param.h>
 #endif
 
-/* <unistd.h> should be included before any preprocessor test
-   of _POSIX_VERSION.  */
 #if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
Index: src/test.c
===================================================================
RCS file: /fetish/cu/src/test.c,v
retrieving revision 1.119
diff -p -u -r1.119 test.c
--- src/test.c  27 May 2005 20:36:58 -0000      1.119
+++ src/test.c  30 May 2005 07:21:33 -0000
@@ -47,19 +47,12 @@
 #include "quote.h"
 #include "strnumcmp.h"
 
-#ifndef _POSIX_VERSION
+#if HAVE_SYS_PARAM_H
 # include <sys/param.h>
-#endif /* _POSIX_VERSION */
+#endif
 
 char *program_name;
 
-#if !defined (_POSIX_VERSION)
-# include <sys/file.h>
-#endif /* !_POSIX_VERSION */
-
-extern gid_t getegid ();
-extern uid_t geteuid ();
-
 /* Exit status for syntax errors, etc.  */
 enum { TEST_TRUE, TEST_FALSE, TEST_FAILURE };
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]