X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsavedir.c;h=4eeda01939fad542ff1d58687b18475a040c175e;hb=37b09d7dc2c5956fbd70c211ed164a9ee1f7e349;hp=112f5c0451abfeb4e3a74fc8d3e93e58ff028b92;hpb=21d2d10d5822fc954d080a5ff31e61a87ada1902;p=gnulib.git diff --git a/lib/savedir.c b/lib/savedir.c index 112f5c045..4eeda0193 100644 --- a/lib/savedir.c +++ b/lib/savedir.c @@ -1,7 +1,7 @@ /* savedir.c -- save the list of files in a directory in a string - Copyright 1990, 1997, 1998, 1999, 2000, 2001 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 . */ @@ -23,12 +23,11 @@ # include #endif +#include "savedir.h" + #include #include -#ifndef errno -extern int errno; -#endif #if HAVE_DIRENT_H # include @@ -52,18 +51,13 @@ extern int errno; # define CLOSEDIR(d) closedir (d) #endif -#ifdef STDC_HEADERS -# include -# include -#endif -#ifndef NULL -# define NULL 0 -#endif +#include +#include +#include -#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. */ @@ -92,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') {