1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00
sortix--sortix/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 18:12:10 -04:00
#ifndef INCLUDE_DIRENT_H
#define INCLUDE_DIRENT_H
#include <sys/cdefs.h>
2015-11-19 20:57:09 -05:00
#include <sortix/dirent.h>
2014-08-03 11:12:56 -04:00
#if defined(__is_sortix_libc)
#include <DIR.h>
#endif
2013-12-26 19:44:03 -05:00
#ifndef __DIR_defined
#define __DIR_defined
2015-05-10 17:40:54 -04:00
typedef struct __DIR DIR;
2013-12-26 19:44:03 -05:00
#endif
2015-11-19 20:57:09 -05:00
#ifdef __cplusplus
extern "C" {
2014-09-14 16:53:54 -04:00
#endif
2015-11-19 20:57:09 -05:00
int closedir(DIR*);
DIR* opendir(const char*);
struct dirent* readdir(DIR*);
void rewinddir(DIR*);
2014-09-14 16:53:54 -04:00
#if __USE_SORTIX || __USE_XOPEN
/* TODO: seekdir */
/* TODO: telldir */
2014-09-14 16:53:54 -04: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-19 20:57:09 -05:00
int dirfd(DIR*);
DIR* fdopendir(int);
2014-09-14 16:53:54 -04: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 13:20:46 -04:00
int versionsort(const struct dirent**, const struct dirent**);
2014-09-14 16:53:54 -04:00
#endif
2014-09-14 16:53:54 -04:00
/* Functions that are Sortix extensions. */
#if __USE_SORTIX
2014-09-14 16:53:54 -04: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 12:11:02 -04:00
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif