summaryrefslogtreecommitdiff
path: root/dirent/list.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-18 12:22:11 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-18 12:22:11 +0000
commit80a18298f02005310cf0edc6163ae5eff5fad09a (patch)
treefa4db80e6d033ac93658d00c347eae9dae768d45 /dirent/list.c
parent9eecb5e8f3903a6fe66ac88f9218935130e77042 (diff)
Update.
* dirent/list.c (test): Return error value. (main): Exit with error value. * sysdeps/unix/opendir.c (__opendir): Add missing initialization. * Makefile (distribute): Add test-skeleton.c. * test-skeleton.c: New file. * dirent/Makefile (tests): Add opendir-tst1. * dirent/opendir-tst1.c: New file. 1998-03-18 Ulrich Drepper <drepper@cygnus.com> Optimize memory handling.
Diffstat (limited to 'dirent/list.c')
-rw-r--r--dirent/list.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/dirent/list.c b/dirent/list.c
index 38f770f0ed..6ce22c6ea1 100644
--- a/dirent/list.c
+++ b/dirent/list.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,11 +23,12 @@
#include <dirent.h>
-void
+int
test (const char *name)
{
DIR *dirp;
struct dirent *entp;
+ int retval = 0;
puts (name);
@@ -35,7 +36,7 @@ test (const char *name)
if (dirp == NULL)
{
perror ("opendir");
- return;
+ return 1;
}
errno = 0;
@@ -44,24 +45,32 @@ test (const char *name)
entp->d_name, (unsigned long int) entp->d_fileno);
if (errno)
- perror ("readdir");
+ {
+ perror ("readdir");
+ retval = 1;
+ }
if (closedir (dirp) < 0)
- perror ("closedir");
+ {
+ perror ("closedir");
+ retval = 1;
+ }
+
+ return retval;
}
int
main (int argc, char **argv)
{
+ int retval = 0;
--argc;
++argv;
if (argc == 0)
- test (".");
+ retval = test (".");
else
while (argc-- > 0)
- test (*argv++);
+ retval |= test (*argv++);
- exit (0);
- return 0;
+ return retval;
}