1 /* ndir.c - portable directory routines 2 Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 1, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 18 $Header: /u/src/master/ccvs/windows-NT/ndir.h,v 1.4 1996/01/03 21:15:00 kingdon Exp $ 19 */ 20 21 /* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4 22 87/11/06. A public domain implementation of BSD directory routines 23 for MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield), 24 August 1897 */ 25 26 #include <sys/types.h> /* ino_t definition */ 27 28 #define rewinddir(dirp) seekdir(dirp, 0L) 29 30 /* 255 is said to be big enough for Windows NT. The more elegant 31 solution would be declaring d_name as one byte long and allocating 32 it to the actual size needed. */ 33 #define MAXNAMLEN 255 34 35 struct direct 36 { 37 ino_t d_ino; /* a bit of a farce */ 38 int d_reclen; /* more farce */ 39 int d_namlen; /* length of d_name */ 40 char d_name[MAXNAMLEN + 1]; /* garentee null termination */ 41 }; 42 43 struct _dircontents 44 { 45 char *_d_entry; 46 struct _dircontents *_d_next; 47 }; 48 49 typedef struct _dirdesc 50 { 51 int dd_id; /* uniquely identify each open directory */ 52 long dd_loc; /* where we are in directory entry is this */ 53 struct _dircontents *dd_contents; /* pointer to contents of dir */ 54 struct _dircontents *dd_cp; /* pointer to current position */ 55 } DIR; 56 57 extern void seekdir (DIR *, long); 58 extern long telldir (DIR *); 59 extern DIR *opendir (const char *); 60 extern void closedir (DIR *); 61 extern struct direct *readdir (DIR *); 62 63 /* 64 * Local Variables: 65 * mode:C 66 * ChangeLog:ChangeLog 67 * compile-command:make 68 * End: 69 */ 70