summaryrefslogtreecommitdiff
path: root/test/stdlib
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-01-29 02:56:45 +0000
committerMike Frysinger <vapier@gentoo.org>2007-01-29 02:56:45 +0000
commit92a56f367e6635bebf4e519a49943c15d2981d85 (patch)
tree8d0cc34ab7791579c5e7979bc09b5ede8b1bc7be /test/stdlib
parent55aaeb574609ff7fb7ac93ce4ffe01be0a56f5b7 (diff)
fixup prototype warnings
Diffstat (limited to 'test/stdlib')
-rw-r--r--test/stdlib/qsort.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/test/stdlib/qsort.c b/test/stdlib/qsort.c
index 9e706c78d..abc505e2d 100644
--- a/test/stdlib/qsort.c
+++ b/test/stdlib/qsort.c
@@ -3,45 +3,43 @@
#include <stdlib.h>
#include <unistd.h>
-int select_files(const struct dirent *dirbuf)
+static int select_files(const struct dirent *dirbuf)
{
- if (dirbuf->d_name[0] == '.')
- return 0;
- else
- return 1;
+ if (dirbuf->d_name[0] == '.')
+ return 0;
+ else
+ return 1;
}
-
int main(void)
{
- struct dirent **array;
- struct dirent *dirbuf;
+ struct dirent **array;
+ struct dirent *dirbuf;
- int i, numdir;
+ int i, numdir;
- chdir("/");
- numdir = scandir(".", &array, select_files, NULL);
- printf("\nGot %d entries from scandir().\n", numdir);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- free(array[i]);
- }
- free(array);
- numdir = scandir(".", &array, select_files, alphasort);
- printf("\nGot %d entries from scandir() using alphasort().\n", numdir);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- }
- printf("\nCalling qsort()\n");
- qsort(array, numdir, sizeof(struct dirent *), alphasort);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- free(array[i]);
- }
- free(array);
- return(0);
+ chdir("/");
+ numdir = scandir(".", &array, select_files, NULL);
+ printf("\nGot %d entries from scandir().\n", numdir);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ free(array[i]);
+ }
+ free(array);
+ numdir = scandir(".", &array, select_files, alphasort);
+ printf("\nGot %d entries from scandir() using alphasort().\n", numdir);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ }
+ printf("\nCalling qsort()\n");
+ qsort(array, numdir, sizeof(struct dirent *), alphasort);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ free(array[i]);
+ }
+ free(array);
+ return (0);
}
-