New module 'tls'.
[gnulib.git] / lib / savedir.c
index a1f8a6c..4eeda01 100644 (file)
@@ -1,7 +1,7 @@
 /* savedir.c -- save the list of files in a directory in a string
 
-   Copyright 1990, 1997, 1998, 1999, 2000, 2001, 2003 Free Software
-   Foundation, Inc.
+   Copyright 1990, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 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
@@ -15,7 +15,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software Foundation,
-   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
 
 # include <config.h>
 #endif
 
+#include "savedir.h"
+
 #include <sys/types.h>
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #if HAVE_DIRENT_H
 # include <dirent.h>
@@ -52,16 +51,13 @@ extern int errno;
 # define CLOSEDIR(d) closedir (d)
 #endif
 
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif
 #include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
 
-#include "savedir.h"
 #include "xalloc.h"
 
-/* Return a freshly allocated string containing the filenames
+/* Return a freshly allocated string containing the file names
    in directory DIR, separated by '\0' characters;
    the end is marked by two '\0' characters in a row.
    Return NULL (setting errno) if DIR cannot be opened, read, or closed.  */
@@ -90,7 +86,7 @@ savedir (const char *dir)
   while ((dp = readdir (dirp)) != NULL)
     {
       /* Skip "", ".", and "..".  "" is returned by at least one buggy
-         implementation: Solaris 2.4 readdir on NFS filesystems.  */
+         implementation: Solaris 2.4 readdir on NFS file systems.  */
       char const *entry = dp->d_name;
       if (entry[entry[0] != '.' ? 0 : entry[1] != '.' ? 1 : 2] != '\0')
        {