sortix-mirror/libc/include/dirent.h

85 lines
2.3 KiB
C
Raw Normal View History

/*
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2018 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* dirent.h
* Format of directory entries.
*/
2013-06-21 22:12:10 +00:00
#ifndef INCLUDE_DIRENT_H
#define INCLUDE_DIRENT_H
#include <sys/cdefs.h>
2015-11-20 01:57:09 +00:00
#include <sortix/dirent.h>
2014-08-03 15:12:56 +00:00
#if defined(__is_sortix_libc)
#include <DIR.h>
#endif
2013-12-27 00:44:03 +00:00
#ifndef __DIR_defined
#define __DIR_defined
2015-05-10 21:40:54 +00:00
typedef struct __DIR DIR;
2013-12-27 00:44:03 +00:00
#endif
2015-11-20 01:57:09 +00:00
#ifdef __cplusplus
extern "C" {
2014-09-14 20:53:54 +00:00
#endif
2015-11-20 01:57:09 +00:00
int closedir(DIR*);
DIR* opendir(const char*);
struct dirent* readdir(DIR*);
void rewinddir(DIR*);
2014-09-14 20:53:54 +00:00
#if __USE_SORTIX || __USE_XOPEN
/* TODO: seekdir */
/* TODO: telldir */
2014-09-14 20:53:54 +00:00
#endif
/* Functions from POSIX 1995. */
#if 199506L <= __USE_POSIX
/* readdir_r will not be implemented. */
#endif
/* Functions from POSIX 2008. */
#if __USE_SORTIX || 200809L <= __USE_POSIX
int alphasort(const struct dirent**, const struct dirent**);
2015-11-20 01:57:09 +00:00
int dirfd(DIR*);
DIR* fdopendir(int);
2014-09-14 20:53:54 +00:00
int scandir(const char*, struct dirent***, int (*)(const struct dirent*),
int (*)(const struct dirent**, const struct dirent**));
#endif
/* Functions copied from elsewhere. */
#if __USE_SORTIX
2013-06-24 17:20:46 +00:00
int versionsort(const struct dirent**, const struct dirent**);
2014-09-14 20:53:54 +00:00
#endif
2014-09-14 20:53:54 +00:00
/* Functions that are Sortix extensions. */
#if __USE_SORTIX
2014-09-14 20:53:54 +00:00
int alphasort_r(const struct dirent**, const struct dirent**, void*);
int dscandir_r(DIR*, struct dirent***,
int (*)(const struct dirent*, void*),
void*,
int (*)(const struct dirent**, const struct dirent**, void*),
void*);
int versionsort_r(const struct dirent**, const struct dirent**, void*);
#endif
2015-05-13 16:11:02 +00:00
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif