* src/copy.c (copy_internal): Don't test whether macros like
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 28 Aug 2006 23:29:38 +0000 (23:29 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 28 Aug 2006 23:29:38 +0000 (23:29 +0000)
S_ISLNK are defined, since they're always defined now.
* src/cp.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/ls.c (get_link_name, make_link_name): Likewise.
* src/mkfifo.c (usage): Likewise.
* src/who.c (S_IWGRP): Likewise.

ChangeLog
src/copy.c
src/cp.c
src/ln.c
src/ls.c
src/mkfifo.c
src/who.c

index 2fb8877..be421b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2006-08-28  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * src/copy.c (copy_internal): Don't test whether macros like
+       S_ISLNK are defined, since they're always defined now.
+       * src/cp.c (main): Likewise.
+       * src/ln.c (main): Likewise.
+       * src/ls.c (get_link_name, make_link_name): Likewise.
+       * src/mkfifo.c (usage): Likewise.
+       * src/who.c (S_IWGRP): Likewise.
+
        Adjust to recent gnulib changes for the gnulib module.
        * bootstrap.conf (gnulib_modules): Add fcntl.
        * src/system.h (SEEK_SET, SEEK_CUR, SEEK_END): Remove.  Other code
index c8d09b4..e1406f7 100644 (file)
@@ -1558,7 +1558,6 @@ copy_internal (char const *src_name, char const *dst_name,
          delayed_ok = false;
        }
     }
-#ifdef S_ISLNK
   else if (x->symbolic_link)
     {
       preserve_metadata = false;
@@ -1597,7 +1596,6 @@ copy_internal (char const *src_name, char const *dst_name,
          goto un_backup;
        }
     }
-#endif
 
   else if (x->hard_link
 #ifdef LINK_FOLLOWS_SYMLINKS
@@ -1632,9 +1630,7 @@ copy_internal (char const *src_name, char const *dst_name,
       if (! copy_reg (src_name, dst_name, x, src_mode, &new_dst, &src_sb))
        goto un_backup;
     }
-  else
-#ifdef S_ISFIFO
-  if (S_ISFIFO (src_type))
+  else if (S_ISFIFO (src_type))
     {
       if (mkfifo (dst_name, src_mode))
        {
@@ -1642,10 +1638,7 @@ copy_internal (char const *src_name, char const *dst_name,
          goto un_backup;
        }
     }
-  else
-#endif
-    if (S_ISBLK (src_type) || S_ISCHR (src_type)
-       || S_ISSOCK (src_type))
+  else if (S_ISBLK (src_type) || S_ISCHR (src_type) || S_ISSOCK (src_type))
     {
       if (mknod (dst_name, src_mode, src_sb.st_rdev))
        {
@@ -1654,9 +1647,7 @@ copy_internal (char const *src_name, char const *dst_name,
          goto un_backup;
        }
     }
-  else
-#ifdef S_ISLNK
-  if (S_ISLNK (src_type))
+  else if (S_ISLNK (src_type))
     {
       char *src_link_val = xreadlink (src_name, src_sb.st_size);
       if (src_link_val == NULL)
@@ -1700,7 +1691,7 @@ copy_internal (char const *src_name, char const *dst_name,
        {
          /* Preserve the owner and group of the just-`copied'
             symbolic link, if possible.  */
-# if HAVE_LCHOWN
+#if HAVE_LCHOWN
          if (lchown (dst_name, src_sb.st_uid, src_sb.st_gid) != 0
              && ! chown_failure_ok (x))
            {
@@ -1708,16 +1699,15 @@ copy_internal (char const *src_name, char const *dst_name,
                     dst_name);
              goto un_backup;
            }
-# else
+#else
          /* Can't preserve ownership of symlinks.
             FIXME: maybe give a warning or even error for symlinks
             in directories with the sticky bit set -- there, not
             preserving owner/group is a potential security problem.  */
-# endif
+#endif
        }
     }
   else
-#endif
     {
       error (0, 0, _("%s has unknown file type"), quote (src_name));
       goto un_backup;
index 539180b..c1751cf 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -957,12 +957,7 @@ main (int argc, char **argv)
          break;
 
        case 's':
-#ifdef S_ISLNK
          x.symbolic_link = true;
-#else
-         error (EXIT_FAILURE, 0,
-                _("symbolic links are not supported on this system"));
-#endif
          break;
 
        case 't':
index 5dd3c51..c544570 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
@@ -428,12 +428,7 @@ main (int argc, char **argv)
          dereference_dest_dir_symlinks = false;
          break;
        case 's':
-#ifdef S_ISLNK
          symbolic_link = true;
-#else
-         error (EXIT_FAILURE, 0,
-                _("symbolic links are not supported on this system"));
-#endif
          break;
        case 't':
          if (target_directory)
index 4d71f32..b33edb3 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -2760,9 +2760,6 @@ is_directory (const struct fileinfo *f)
   return f->filetype == directory || f->filetype == arg_directory;
 }
 
-
-#ifdef S_ISLNK
-
 /* Put the name of the file that FILENAME is a symbolic link to
    into the LINKNAME field of `f'.  COMMAND_LINE_ARG indicates whether
    FILENAME is a command-line argument.  */
@@ -2805,7 +2802,6 @@ make_link_name (char const *name, char const *linkname)
   strcpy (linkbuf + bufsiz, linkname);
   return linkbuf;
 }
-#endif
 
 /* Return true if the last component of NAME is `.' or `..'
    This is so we don't try to recurse on `././././. ...' */
index a16d93c..d329b79 100644 (file)
@@ -43,7 +43,6 @@ static struct option const longopts[] =
   {NULL, 0, NULL, 0}
 };
 
-#ifdef S_ISFIFO
 void
 usage (int status)
 {
@@ -69,7 +68,6 @@ Mandatory arguments to long options are mandatory for short options too.\n\
     }
   exit (status);
 }
-#endif
 
 int
 main (int argc, char **argv)
@@ -87,9 +85,6 @@ main (int argc, char **argv)
 
   atexit (close_stdout);
 
-#ifndef S_ISFIFO
-  error (EXIT_FAILURE, 0, _("fifo files not supported"));
-#else
   while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
     {
       switch (optc)
@@ -131,5 +126,4 @@ main (int argc, char **argv)
       }
 
   exit (exit_status);
-#endif
 }
index f144bbc..82921b0 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -1,5 +1,5 @@
 /* GNU's who.
-   Copyright (C) 1992-2005 Free Software Foundation, Inc.
+   Copyright (C) 1992-2006 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
 # define MAXHOSTNAMELEN 64
 #endif
 
-#ifndef S_IWGRP
-# define S_IWGRP 020
-#endif
-
 #ifdef RUN_LVL
 # define UT_TYPE_RUN_LVL(U) UT_TYPE_EQ (U, RUN_LVL)
 #else