1995-08-09 08:06:35 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1999-11-17 10:59:06 -08:00
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
|
|
|
/* under the terms of the GNU Library General Public License. */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2001-11-26 07:49:57 -08:00
|
|
|
/* This avoids "overflow" errors when reading from very large directories
|
|
|
|
(PR#609) */
|
|
|
|
#define _FILE_OFFSET_BITS 64
|
|
|
|
|
1995-05-08 08:18:32 -07:00
|
|
|
#include <mlvalues.h>
|
|
|
|
#include <fail.h>
|
|
|
|
#include <alloc.h>
|
1996-09-04 07:15:31 -07:00
|
|
|
#include "unixsupport.h"
|
1995-05-08 08:18:32 -07:00
|
|
|
#include <sys/types.h>
|
|
|
|
#ifdef HAS_DIRENT
|
|
|
|
#include <dirent.h>
|
|
|
|
typedef struct dirent directory_entry;
|
|
|
|
#else
|
|
|
|
#include <sys/dir.h>
|
|
|
|
typedef struct direct directory_entry;
|
|
|
|
#endif
|
|
|
|
|
2001-08-28 07:47:48 -07:00
|
|
|
CAMLprim value unix_readdir(value d)
|
1995-05-08 08:18:32 -07:00
|
|
|
{
|
|
|
|
directory_entry * e;
|
|
|
|
|
|
|
|
e = readdir((DIR *) d);
|
1995-06-18 07:59:32 -07:00
|
|
|
if (e == (directory_entry *) NULL) raise_end_of_file();
|
1995-05-08 08:18:32 -07:00
|
|
|
return copy_string(e->d_name);
|
|
|
|
}
|