Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-09-19 19:54:12 +0400
committerChristopher Faylor <me@cgf.cx>2001-09-19 19:54:12 +0400
commit596f3269b00bc497b2fd82d9ec4bc748fe7b6fab (patch)
tree2aa6add3324d3b40db1619e394973a4f43a8f4d1 /winsup/cygwin/scandir.cc
parent487fb5f1c4da8cf18600e84e8b317e0e42ce1bff (diff)
* lib/getopt.c: Use __progname==__argv[0] when not compiling for cygwin.
* scandir.cc (scandir): Use correct default when compar == NULL.
Diffstat (limited to 'winsup/cygwin/scandir.cc')
-rw-r--r--winsup/cygwin/scandir.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/winsup/cygwin/scandir.cc b/winsup/cygwin/scandir.cc
index b2888e23d..52a36eab6 100644
--- a/winsup/cygwin/scandir.cc
+++ b/winsup/cygwin/scandir.cc
@@ -16,8 +16,13 @@
#include <errno.h>
#include "cygerrno.h"
-extern "C"
-int
+extern "C" int
+alphasort (const struct dirent **a, const struct dirent **b)
+{
+ return strcoll ((*a)->d_name, (*b)->d_name);
+}
+
+extern "C" int
scandir (const char *dir,
struct dirent ***namelist,
int (*select) (const struct dirent *),
@@ -33,6 +38,8 @@ scandir (const char *dir,
int prior_errno = get_errno ();
set_errno (0);
+ if (!compar)
+ compar = alphasort;
while ((ent = readdir (dirp)))
{
@@ -91,11 +98,3 @@ scandir (const char *dir,
*namelist = nl;
return count;
}
-
-extern "C"
-int
-alphasort (const struct dirent **a, const struct dirent **b)
-{
- return strcoll ((*a)->d_name, (*b)->d_name);
-}
-