summaryrefslogtreecommitdiff
path: root/userland/libc/dirent/opendir.c
blob: 7bfa562287095600394b26520ffd2cb1059dde62 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <dirent.h>

DIR *opendir(const char *dirname) {
  int fd = open(dirname, O_RDONLY, 0);
  if (-1 == fd)
    return NULL;
  DIR *rc = malloc(sizeof(DIR));
  rc->fd = fd;
  rc->dir_num = 0;
  return rc;
}