Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

ndir.h

Go to the documentation of this file.
00001 /*  ndir.c - portable directory routines
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 
00018     $Header: /cvsroot/e32frodo/e32frodo/src/ndir.h,v 1.3 2001/12/08 11:52:30 alfredh Exp $
00019  */
00020 
00021 /* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4
00022    87/11/06.  A public domain implementation of BSD directory routines
00023    for MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
00024    August 1897 */
00025 
00026 #ifndef NDIR_H__
00027 #define NDIR_H__
00028 #include <sys/types.h>  /* ino_t definition */
00029 
00030 // AEH 991113
00031 #include <sys/unistd.h> /* ino_t definition */
00032 
00033 #define rewinddir(dirp) seekdir(dirp, 0L)
00034 
00035 /* 255 is said to be big enough for Windows NT.  The more elegant
00036    solution would be declaring d_name as one byte long and allocating
00037    it to the actual size needed.  */
00038 
00039 //#ifndef MAXNAMLEN
00040 //#define       MAXNAMLEN       255
00041 //#endif
00042 
00043 struct direct
00044 {
00045   ino_t d_ino;                  /* a bit of a farce */
00046   int d_reclen;                 /* more farce */
00047   int d_namlen;                 /* length of d_name */
00048   char d_name[MAXNAMLEN + 1];   /* garentee null termination */
00049 };
00050 
00051 struct _dircontents
00052 {
00053   char *_d_entry;
00054   struct _dircontents *_d_next;
00055 };
00056 
00057 typedef struct _dirdesc
00058 {
00059   int dd_id;                    /* uniquely identify each open directory */
00060   long dd_loc;                  /* where we are in directory entry is this */
00061   struct _dircontents *dd_contents;     /* pointer to contents of dir */
00062   struct _dircontents *dd_cp;   /* pointer to current position */
00063 } DIR;
00064 
00065 extern void seekdir (DIR *, long);
00066 extern long telldir (DIR *);
00067 extern DIR *opendir (const char *);
00068 extern void closedir (DIR *);
00069 extern struct direct *readdir (DIR *);
00070 
00071 /* 
00072  * Local Variables:
00073  * mode:C
00074  * ChangeLog:ChangeLog
00075  * compile-command:make
00076  * End:
00077  */
00078 #endif // NDIR_H__

Generated on Tue Feb 8 04:08:02 2005 for E32frodo by doxygen 1.3.3